On 1/22/19 4:20 PM, Richard W.M. Jones wrote:
Test the partition filter against real life partition tables created
by sfdisk.
---
+
+test dos 1 <<'EOF'
+2048 1023 L -
+EOF
+
+test dos 2 <<'EOF'
+2048 1023 L -
+4096 4095 L -
+EOF
I don't know how to make sfdisk populate ONLY partition 2 using
non-label form (short of populating both 1 and 2, then deleting
partition 1), but as there are disks in the wild like that, it might
make for an interesting test. But I _do_ know how to do it using
labeled form, by doing it manually and then letting --dump tell me how
to repeat it:
$ truncate --size 1G disk
$ sfdisk -X dos disk <<\EOF
, 100M
, 100M
EOF
$ sfdisk --delete disk 1
$ sfdisk --dump disk
label: dos
label-id: 0x1b18e388
device: disk
unit: sectors
disk2 : start= 206848, size= 204800, type=83
In fact, labeled form is how you convince sfdisk to create partitions in
non-ascending order, to the point that 'sfdisk --reorder' then shuffles
the tables (but not the partitions themselves) to be back in ascending
order (of course, reordering can invalidate /etc/fstab and other
references in the guest OS that were keying off of partition number
instead of label)
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization:
qemu.org |
libvirt.org