Search code examples
centos7rhel7

While trying to create file system on my partition getting an error


Iam operating centos 7 on a virtual machine I have /dev/sdb of size 1G

I used the following command to create a extended partition

fdisk /dev/sdb

n -- for adding new partition

e -- extended

Partition number --1

First sector -- default

Last sector -- +512M

entered W

partprobe /dev/sdb

mkfs.ext4 /dev/sdb1 /mnt

Got this error

Mke2fs 1.42.9 (28-dec-2013) Mkfs.ext4 : invalid blocks '/mnt' on device '/dev/sdb1'

Not able to figure it out I created a directory /data and tried it in place of /mnt still not worked


Solution

  • according to man mkfs.ext4 you need to either ignore last parameter given (/mnt) becasue the last argument AFTER the device is fs-size, not some path OR provide actual fs-size, like 512m