[parted-devel] Deleting loop partition clears XFS signatures

Mike Fleetwood mike.fleetwood at googlemail.com
Fri Feb 20 08:55:50 UTC 2015


Hi,

I happened to look at this commit in parted:
  libparted: don't trash filesystem when writing loop label
  http://git.savannah.gnu.org/cgit/parted.git/commit/?id=1be70093eb937f34388e06ce3731e5f56f217950

It tries to avoid stomping on the super block of whole disk file systems
when the virtual partition covering the whole disk is deleted.  It
writes just the loop signature "GNU Parted Loopback 0" at byte offset 0
on the disk.  However the XFS super block and it's signature start at
byte offset 0 too, so this renders the XFS file system undetectable,
effectively deleting it.

With a whole disk ext4 file system, deleting the virtual partition is
effectively a no-operation as the ext4 file system remains intact and is
still detected on the whole disk device.

It appears that deletion of the virtual loop partition is trying to be
as close as possible a no-operation, yet still leave the device detected
with a loop partition table.  So either: 1) the device contains the
loop signature or 2) contains a libparted recognised file system
signature.  In both cases it will still be recognised as containing a
loop partition table when re-read.  If something else erases the
signature in the mean time then that is something else's responsibility
and a new loop partition table can be re-created.  Therefore I think
deletion of the virtual loop partition table should truly be a
no-operation.

Thanks,
Mike


# mkfs.xfs -f /dev/sdc
# dd if=/dev/sdc bs=64 count=1 2> /dev/null | hexdump -C
00000000  58 46 53 42 00 00 10 00  00 00 00 00 00 20 00 00  |XFSB......... ..|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000020  ee 09 f3 0b 4a 92 43 7f  b0 1b 2f 56 bf a8 53 fc  |....J.C.../V..S.|
00000030  00 00 00 00 00 10 00 04  00 00 00 00 00 00 00 80  |................|
00000040
# parted /dev/sdc
GNU Parted 3.2
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 8590MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system  Flags
 1      0.00B  8590MB  8590MB  xfs

(parted) rm 1
(parted) print
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 8590MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End  Size  File system  Flags

(parted) quit
Information: You may need to update /etc/fstab.

# dd if=/dev/sdc bs=64 count=1 2> /dev/null | hexdump -C
00000000  47 4e 55 20 50 61 72 74  65 64 20 4c 6f 6f 70 62  |GNU Parted Loopb|
00000010  61 63 6b 20 30 00 00 00  00 00 00 00 00 00 00 00  |ack 0...........|
00000020  ee 09 f3 0b 4a 92 43 7f  b0 1b 2f 56 bf a8 53 fc  |....J.C.../V..S.|
00000030  00 00 00 00 00 10 00 04  00 00 00 00 00 00 00 80  |................|
00000040



More information about the parted-devel mailing list