Description of problem: We use wipefs as part of the libguestfs tests, and I've noticed two (related) changes recently. One is not a bug, the other seems to be a bug. First change: You can no longer wipe a mounted filesystem, eg: mount /dev/sda1 /foo wipefs -a /dev/sda1 fails with: /dev/sda1: probing initialization failed: Device or resource busy That is obviously NOT a bug. You don't want to be able to wipe a filesystem which the kernel has mounted. However a second error looks like it is a bug: wipefs -a /dev/sda /dev/sda: probing initialization failed: Device or resource busy In this second case, /dev/sda contains partitions, but nothing is mounted. Obviously I want to erase the partitions which is the whole point of running wipefs(!) Version-Release number of selected component (if applicable): util-linux.x86_64 0:2.22.1-3.fc19 (for other packages, see: http://kojipkgs.fedoraproject.org//work/tasks/1830/4651830/root.log) How reproducible: 100% Steps to Reproduce: 1. Run the libguestfs tests on Rawhide. Additional info: Example of the second failure: http://kojipkgs.fedoraproject.org//work/tasks/1830/4651830/build.log
This worked with util-linux 2.22.1-1.fc19 & coreutils 8.17. It was when I upgraded to util-linux 2.22.1-3 & coreutils 8.20 that it breaks.
Patch posted to add --force option: http://article.gmane.org/gmane.linux.utilities.util-linux-ng/6801
Here is the libguestfs patch that this was tested alongside: https://www.redhat.com/archives/libguestfs/2012-November/msg00028.html
(In reply to comment #0) > However a second error looks like it is a bug: > > wipefs -a /dev/sda > /dev/sda: probing initialization failed: Device or resource busy > > In this second case, /dev/sda contains partitions, but nothing is > mounted. I have doubts that nothing is mounted... partitioned device, nothing mounted: # strace -e open ./wipefs --no-act -a /dev/sdb 2>&1 | grep sdb open("/dev/sdb", O_RDWR|O_EXCL) = 3 success! partitioned device, sdb1 mounted: # mount /dev/sdb1 /mnt/test # strace -e open ./wipefs --no-act -a /dev/sdb 2>&1 | grep sdb open("/dev/sdb", O_RDWR|O_EXCL) = -1 EBUSY (Device or resource busy) it means that partition table has no impact to O_EXCL, the problem is if any partition is mounted. It all seems like correct and expected ... I think we don't want to allow to delete partition table if any partition is actively used.
Continued on list at: http://article.gmane.org/gmane.linux.utilities.util-linux-ng/6806 Since the --force patch has been added to wipefs and it appears to work, I'm closing the bug as fixed, but would appreciate it if the patch could be added to F18 also to make the virt-format tool work.
Fixed by upstream commit 2968c3fc7388f88b8debe64d61d9785601c16436.