Why do we need sleep in reread_disk_partition function in sfdisk?
I am facing an issue while partitioning my disk using sfdisk.
I have partitioned my disk using sfdisk. And the (7)partitions got created successfully. sfdisk -l also lists all the (7) partitions which I configured. But the strange thing is, the corresponding block files for (6th and 7th) /dev/sdX6,/dev/sdX7 are missing. I could not figure out what is going wrong. I could see the following messages while using sfdisk command.
"Successfully wrote the new partition table
Re-reading the partition table ...
BLKRRPART: Device or resource busy
The command to re-read the partition table failed.
Run partprobe(8), kpartx(8) or reboot your system now,
before using mkfs"
So I was just going through the sfdisk source code to understand the issue. I found
reread_disk_partition(char *dev, int fd) {
printf(_("Re-reading the partition table ...\n"));
fflush(stdout);
sync();
sleep(3); /* superfluous since 1.3.20 */ <<<<<------------------
if (reread_ioctl(fd) && is_blockdev(fd))
........
}
sleep for 3 seconds. Anyone aware of why this sleep is needed? I am thinking of increasing the sleep to 5 seconds. Will it solve my problem?
Last edited by kalai_karthick; 04-28-2016 at 07:25 AM.
|