Linux shell is most popular than GUI in Linux systems and most of Linux administrators doing their tasks and system configurations via shell. But shell is most difficult than GUI. They do many thing via shell for example adding new disks or partitions for applications and services.
Sometimes administrators and users faced with the below messages after create new partitions:
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)
Or after run “mkfs.extX” command to create file-system on the partition:
Could not stat /dev/sdXX — No such file or directory
The device apparently does not exist; did you specify it correctly?
Actually, kernel couldn’t reload partition table at this situation and ask administrator to reboot the machine for reloading partition table.
This utility is the first solution for reloading partition table of the disk. It’s installed on most distribution by default.
Run the below command to reload partition table manually:
partprobe /dev/sdX (X is the device letter)
If Partprobe doesn’t work and the below error message was shown:
Error: Could not stat device /dev/sdX – No such file or directory
Try another solution from the below solutions.
The Hdparm utility is a general hard disk utility in Linux, try the below command to reload partition table:
hdparm -z /dev/sdX (X is the device letter)
Kpartx / Partx
These two utility can reload partition table. Kpartx is generally use for Multipath devices and partx using for local devices:
kpartx -a /dev/sdX (X is the device letter)
partx -v -a /dev/sdX (X is the device letter)
If the above utility couldn’t resolve issue, the last solution is last. This solution force kernel to reload the device:
echo 1 > /sys/block/sdX/device/rescan (X is the device letter)
After all if the problem is still exist. There is no solution except rebooting OS!
4,200 total views, 32 views today