(this is a WIP proposal and will be updated along my thought process)
Some mkfs tools as called via org.freedesktop.UDisks2.Block.Format() create a protective partition table with a partition that overlaps the partition table area (i.e. a compat/protective/fake partition table that is part of the filesystem superblock itself). That is typically detected by the kernel and extra block devices are exposed by udev.
Requirements:
keep the UDisks API stable, expect that the current clients will continue using the original block device for mounting or further usage
Open questions:
consider adding a new org.freedesktop.UDisks2.Block.Format() option indicating that the client understands the protective partition table and switches to a child block device usage instead of whole-disk
Suggestions:
either add new property ProtectiveTable to the org.freedesktop.UDisks2.PartitionTable interface or add new type protective-mbr in the org.freedesktop.UDisks2.PartitionTable.Type enum when one of the partitions start at 0 sector boundary. Currently with util-linux-2.37 the value is empty for VFAT.
deny any calls to org.freedesktop.UDisks2.Block.Format() on the partitions in such case, allow only on the whole-disk object. This will also make sure wipefs is called on the right device to erase the remains of such partition table.
when mkfs is called on an unpartitioned block device (no org.freedesktop.UDisks2.PartitionTable or org.freedesktop.UDisks2.Partition interfaces present on the block object), issue BLKRRPART and trigger uevent sync in case the filesystem type hints indicate a possible protective partition table presence (will be provided by libblockdev 3.x filesystem definition flags). Then check for presence of the org.freedesktop.UDisks2.PartitionTable interface and trigger uevents on all the partitions if any. All this within the actual method call.
(this is a WIP proposal and will be updated along my thought process)
Some
mkfs
tools as called viaorg.freedesktop.UDisks2.Block.Format()
create a protective partition table with a partition that overlaps the partition table area (i.e. a compat/protective/fake partition table that is part of the filesystem superblock itself). That is typically detected by the kernel and extra block devices are exposed by udev.Requirements:
Open questions:
org.freedesktop.UDisks2.Block.Format()
option indicating that the client understands the protective partition table and switches to a child block device usage instead of whole-diskSuggestions:
org.freedesktop.UDisks2.PartitionTable
interface or add new type protective-mbr in theorg.freedesktop.UDisks2.PartitionTable.Type
enum when one of the partitions start at 0 sector boundary. Currently withutil-linux-2.37
the value is empty for VFAT.deny any calls toorg.freedesktop.UDisks2.Block.Format()
on the partitions in such case, allow only on the whole-disk object. This will also make surewipefs
is called on the right device to erase the remains of such partition table.whenmkfs
is called on an unpartitioned block device (noorg.freedesktop.UDisks2.PartitionTable
ororg.freedesktop.UDisks2.Partition
interfaces present on the block object), issueBLKRRPART
and trigger uevent sync in case the filesystem type hints indicate a possible protective partition table presence (will be provided by libblockdev 3.x filesystem definition flags). Then check for presence of theorg.freedesktop.UDisks2.PartitionTable
interface and trigger uevents on all the partitions if any. All this within the actual method call.Related:
add simple tests to expect a child block objectmultiple-fs-over-format tests: #858util-linux
: https://github.com/karelzak/util-linux/tree/master/tests/ts/blkid/images-fs