Eric Blake
2019-Jan-22 23:04 UTC
Re: [Libguestfs] [PATCH nbdkit v3 2/5] tests: Implement a better nbdkit-partition-filter test.
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 - > +EOFI 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
Richard W.M. Jones
2019-Jan-23 09:55 UTC
Re: [Libguestfs] [PATCH nbdkit v3 2/5] tests: Implement a better nbdkit-partition-filter test.
Indeed this test fails: test dos 2 1 <<'EOF' disk2: start=1024 size=1023 type=L EOF with the error "MBR partition 2 not found". I'll see about fixing this. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Richard W.M. Jones
2019-Jan-23 10:13 UTC
Re: [Libguestfs] [PATCH nbdkit v3 2/5] tests: Implement a better nbdkit-partition-filter test.
On Wed, Jan 23, 2019 at 09:55:00AM +0000, Richard W.M. Jones wrote:> > Indeed this test fails: > > test dos 2 1 <<'EOF' > disk2: start=1024 size=1023 type=L > EOF > > with the error "MBR partition 2 not found".In fact this is because sfdisk interprets "type=L" silently as type=0. You can't use the short codes instead of type bytes here. Also our partition filter ignores any partitions with type=0 (should it?). In any case if I use a proper type byte it works fine. I'll add the new test anyway. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Seemingly Similar Threads
- Re: [PATCH nbdkit v3 2/5] tests: Implement a better nbdkit-partition-filter test.
- [PATCH nbdkit v3 2/5] tests: Implement a better nbdkit-partition-filter test.
- [PATCH nbdkit v2 3/4] tests: Implement a better nbdkit-partition-filter test.
- [PATCH nbdkit v3 0/5] partition filter: Support MBR logical partitions.
- [RFC PATCH v1 1/3] tests: md: Test guestfish list-filesystems command skipps partitioned md devices