Note: This is a repost of my email on Dec 21, 2009 which appears to have been held up due to the size of attachments. As such I am reposting with no attachments.
------------------------------

I am seeking help to resolve a intermittent problem when using the
libparted library.


PROBLEM

The problem is that on newer GNU/Linux distributions, the libparted library occasionally reports the following error message:

     The kernel was unable to re-read the partition table on /dev/sdb
     (Device or resource busy).  This means Linux won't know anything
     about the modifications you made until you reboot.  You should
     reboot your computer before doing anything with /dev/sdb.

The occurrence of this error is intermittent.

I have produced a snippet of code and a script that will reproduce the problem. This problem occurs on Fedora 12 with parted-1.9.0-17 and with parted-2.1.

I am not sure if the root cause is a problem with my code, with the
parted library, or with some other component of a GNU/Linux distribution.

Due to the intermittent nature of the error I suspect some sort of race
condition, possibly related to the kernel and udev.

It should be noted that this problem also occurs with Debian Sid that we use on the GParted Live CD. The problem does not appear to occur on older distributions, such as Ubuntu 8.04.

Any help with this problem would be much appreciated.

Sincerely,
Curtis Gedak
Maintainer of GParted


STEPS TO REPRODUCE PROBLEM

1)  Start with a fedora 12 image.

I built a virtual machine using the Fedora-12-i686-Live.iso image file.

2)  Download the source code and script.
     resize-using-libparted.c:
     https://bugzilla.gnome.org/show_bug.cgi?id=604298#c9

     test-partition-resize.sh
     https://bugzilla.gnome.org/show_bug.cgi?id=604298#c10

2)  Install prerequisites to compile the code:

     $ yum groupinstall "Development Tools"
     $ yum install parted-devel
     $ yum install e2fsprogs-devel

3)  Compile the code

     $ gcc -lparted -ldl -o resize-using-libparted \
          resize-using-libparted.c

4)  Test for the error using a hard disk device with no important data.

      WARNING:  The drive used for testing will be erased!!!

     $ ./test-partition-resize.sh /dev/sdb 99999


SCREEN SHOT

A screen shot of the problem occurring on iteration 242 can be found at the following link:
https://bugzilla.gnome.org/show_bug.cgi?id=604298#c11

This problem is random in nature and can occur at anytime.


RELEVANT GPARTED LINKS

WARNING! Problem Resizing File Systems with GParted
http://gparted-forum.surf4.info/viewtopic.php?id=13777

Bug 604298 -  Problems resizing file systems with gparted-live-0.5.0-3
https://bugzilla.gnome.org/show_bug.cgi?id=604298


_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel

Reply via email to