How to create a new filesystem without reboot in RHEL 6

On creating a new partition in RHEL 6, you might see these messages:

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

You will also not be able to create filesystem on the new partition.

# mkfs.ext4 /dev/sdc2
mke2fs 1.41.12 (17-May-2010)
Could not stat /dev/sdc2 --- No such file or directory

The device apparently does not exist; did you specify it correctly?

The trick in RHEL 5 and earlier was to run partprode /dev/sdx.

# partprobe /dev/sdc
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sdc (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.

It does not work in RHEL 6. It works in RHEL 7 though. You have to reboot to create the filesystem.

There’s an alternative. You will run into this situation only if there is a mounted filesystem from the same disk. In this example, there is an existing fileystem /dev/sdc1 which is mounted. The solution is to unmount any partition or filesystem from this disk and run partprode /dev/sdx. After this you will be able to create filesystem.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s