Feb 25 2008

Avoid Reboot after Partition Change with Fdisk

Published by at 12:00 am under Linux

When modifying the partition table, fdisk usually returns “Device or resource busy” error messages such as:

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.
Syncing disks.
WARNING: re-reading the partition table failed.: device or resource busy


Partprobe from the “parted” package helps fixing this issue, avoiding a useless reboot. From the man page:
“partprobe is a program that informs the operating system kernel of partition table changes, by requesting that the operating system re-read the partition table.”

device or resource busy fdisk
manseok_Kim / Pixabay


Device Busy and Fdisk

Let’s add a new partition on the Linux server with fdisk. /dev/cciss/c0d0 could of course be /dev/sda or anything else.

[root@linux ~]$ fdisk /dev/cciss/c0d0
The number of cylinders for this disk is set to 8854.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/cciss/c0d0: 72.8 GB, 72833679360 bytes
255 heads, 63 sectors/track, 8854 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1   *           1          16      128488+  83  Linux
/dev/cciss/c0d0p2              17        1060     8385930   8e  Linux LVM
/dev/cciss/c0d0p3            1061        2104     8385930   8e  Linux LVM
/dev/cciss/c0d0p4            2105        8854    54219375    5  Extended
/dev/cciss/c0d0p5            2105        5144    24418768+  8e  Linux LVM

Command (m for help): n
First cylinder (5145-8854, default 5145):
Using default value 5145
Last cylinder or +size or +sizeM or +sizeK (5145-8854, default 8854): +1000M

Command (m for help):w
The partition table has been altered!

Calling ioctl() to re-read partition table.

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.
Syncing disks.


The new partition here is not not visible on the system. fdisk -l would show the same thing.
I create LVM partitions but the message would be similar with ext3 or ext4.

[root@linux ~]$ ls /dev/cciss/
c0d0  c0d0p1  c0d0p2  c0d0p3  c0d0p4  c0d0p5


Running partprobe reloads the partition table and brings the partition up:

[root@linux ~]$ partprobe
[root@linux ~]$ ls /dev/cciss/
c0d0  c0d0p1  c0d0p2  c0d0p3  c0d0p4  c0d0p5  c0d0p6


It is now possible to format and mount the partition without rebooting the server.


No responses yet

Comments RSS

Leave a Reply