1, mkfs command to format the partition error message:
[root@localhost ~]# mkfs -t ext4 /dev/sdb7 mke2fs 1.42.9 (28-Dec-2013) Could not stat /dev/sdb7 --- No such file or directory The device apparently does not exist; did you specify it correctly?
2, solution:
Step 1: Install parted package
Whether to install parted package check system
[root@localhost ~]# rpm -q parted parted-3.1-29.el7.x86_64
Parted command to install package
yum -y install parted or rpm -ivh parted-3.1-29.el7.x86_64.rpm
Step two: command execution partprobe
[root@localhost ~]# partprobe Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
The third step: re-format the partition
[root@localhost ~]# mkfs -t ext4 /dev/sdb7 mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 131072 inodes, 524288 blocks 26214 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=536870912 16 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912 Allocating group tables: done Writing inode tables: done Creating journal (16384 blocks): done Writing superblocks and filesystem accounting information: done
Step 4: Check the partition is formatted with the command blkid success
[root@localhost ~]# blkid -s TYPE /dev/sda1: TYPE="xfs" /dev/sda2: TYPE="LVM2_member" /dev/sdb5: TYPE="xfs" /dev/sr0: TYPE="iso9660" /dev/mapper/rhel-root: TYPE="xfs" /dev/mapper/rhel-swap: TYPE="swap" / Dev / sdb7: TYPE = "ext4" # display / dev / sdb7 partition formatted success