Linux 格式化分区 报错Could not stat --- No such file or directory 和 partprobe 命令

来源:互联网 发布:战争雷霆手机数据库 编辑:程序博客网 时间:2024/05/17 14:26
[root@localhost ~]# fdisk /dev/sdaThe device presents a logical sector size that is smaller thanthe physical sector size. Aligning to a physical sector (or optimalI/O) size boundary is recommended, or performance may be impacted.欢迎使用 fdisk (util-linux 2.23.2)。更改将停留在内存中,直到您决定将更改写入磁盘。使用写入命令前请三思。命令(输入 m 获取帮助):m命令操作   a   toggle a bootable flag   b   edit bsd disklabel   c   toggle the dos compatibility flag   d   delete a partition   g   create a new empty GPT partition table   G   create an IRIX (SGI) partition table   l   list known partition types   m   print this menu   n   add a new partition   o   create a new empty DOS partition table   p   print the partition table   q   quit without saving changes   s   create a new empty Sun disklabel   t   change a partition's system id   u   change display/entry units   v   verify the partition table   w   write table to disk and exit   x   extra functionality (experts only)命令(输入 m 获取帮助):nPartition type:   p   primary (2 primary, 0 extended, 2 free)   e   extendedSelect (default p): p分区号 (3,4,默认 3):起始 扇区 (3907024896-3907029167,默认为 3907024896):将使用默认值 3907024896Last 扇区, +扇区 or +size{K,M,G} (3907024896-3907029167,默认为 3907029167):将使用默认值 3907029167分区 3 已设置为 Linux 类型,大小设为 2.1 MiB命令(输入 m 获取帮助):wThe partition table has been altered!Calling ioctl() to re-read partition table.WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.The kernel still uses the old table. The new table will be used atthe next reboot or after you run partprobe(8) or kpartx(8)正在同步磁盘。[root@localhost ~]# fdisk -l磁盘 /dev/sda:2000.4 GB, 2000398934016 字节,3907029168 个扇区Units = 扇区 of 1 * 512 = 512 bytes扇区大小(逻辑/物理):512 字节 / 4096 字节I/O 大小(最小/最佳):4096 字节 / 4096 字节磁盘标签类型:dos磁盘标识符:0x0001e77a   设备 Boot      Start         End      Blocks   Id  System/dev/sda1   *        2048  3774896127  1887447040   83  Linux/dev/sda2      3774896128  3907024895    66064384   82  Linux swap / Solaris/dev/sda3      3907024896  3907029167        2136   83  Linux
分区正常,格式化错误。
[root@localhost ~]# mkfs  /dev/sda3mke2fs 1.42.9 (28-Dec-2013)无法对 /dev/sda3 进行 stat 调用 --- 没有那个文件或目录The device apparently does not exist; did you specify it correctly?

原因是分区信息尚未到分区表里,

解决方法:执行下partprobe 命令

[root@localhost ~]# partprobe
[root@localhost ~]# mkfs -t ext4 /dev/sda3
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=1024 (log=0)
分块大小=1024 (log=0)
Stride=4 blocks, Stripe width=4 blocks
272 inodes, 2136 blocks
106 blocks (4.96%) reserved for the super user
第一个数据块=1
Maximum filesystem blocks=2228224
1 block group
8192 blocks per group, 8192 fragments per group
272 inodes per group


Allocating group tables: 完成                            
正在写入inode表: 完成                            
Creating journal (1024 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

0 0