[parted-devel] some issues with ped_disk_commit_to_os()

Andrew Gaffney agaffney at gentoo.org
Sun Sep 10 20:20:16 UTC 2006


Bart Hakvoort wrote:
> Hi people,
> 
> As many of you probably know gparted uses libparted to create partitions
> and CLI tools to create filesystems on them. While this works quite well
> there has been a small problem since the beginning.
> Whenever i call ped_disk_commit_to_os() (which in turn will call ioctl(int
> fd, BLKRRPART) somewhere in the process) the devicenodes show up after a
> small delay. This delay causes the CLItools to throw a 'device not found'
> error every now and then. I've tried working with sync() and fsync(), but
> without luck so far.
> Till now i simply 'solved' this by sleeping a bit after the reread, but
> this is not perfect and every now and then someone encounters this. Also i
> wonder if there is a better way to solve this?

I've been running into this same thing for over a year in my work with the 
Gentoo Installer. We are blaming udev. It seems like the device nodes are 
created, destroyed, and then created again for some weird reason. I've had cases 
where I commit to disk, check to make the /dev node exists, and then it's gone 
when I call mkfs.foo or whatever on it.

In the installer, I've resorted to calling mkfs.foo in a loop a maximum of 10 
times with a 1s delay after a failure. If the return value is zero, the loop 
breaks and moves on. This obviously only works around the problem.

The reason we blame udev is because we never saw this behavior when the Gentoo 
CDs used devfs.

-- 
Andrew Gaffney                            http://dev.gentoo.org/~agaffney/
Gentoo Linux Developer                                   Installer Project



More information about the parted-devel mailing list