Bug 1248115
Summary: | sfdisk: you cannot change a partition into an extended one or vice versa | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Marian Csontos <mcsontos> | ||||
Component: | util-linux | Assignee: | Karel Zak <kzak> | ||||
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | unspecified | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 22 | CC: | jonathan, kzak, madebr, mbooth, mcsontos, ptoscano, rjones, virt-maint | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | util-linux-2.26.2-3.fc22 | Doc Type: | Bug Fix | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2015-08-19 07:59:52 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Marian Csontos
2015-07-29 15:42:06 UTC
This works for me on Fedora 22, so I guess it must have something to do with the version of sfdisk on Debian vs Fedora (the program was substantially rewritten upstream recently). I have: util-linux-2.26.2-1.fc22.x86_64 What version of sfdisk/util-linux do you have? Sorry, I now see you're actually using Fedora host (not Debian as I thought for some reason). What version of util-linux is it anyway? Same here: util-linux-2.26.2-1.fc22.x86_64 The difference may be I was extracting to an existing thin-LV so the image was resized. Trying virt-builder with `--size 10G` option: it fails: [root@hp-ms-01-c14 ~]# virt-builder debian-6 -o /tmp/test-debian-6 --size 10G [ 0.8] Downloading: http://libguestfs.org/download/builder/debian-6.xz [ 1.9] Planning how to build this image [ 1.9] Uncompressing [ 29.7] Resizing (using virt-resize) to expand the disk to 10.0G virt-resize: error: libguestfs error: part_set_mbr_id: sfdisk --part-type: You cannot change a partition into an extended one or vice versa. Delete it first. sfdisk: /dev/sdb: partition 2: failed to set partition type If reporting bugs, run virt-resize with debugging enabled and include the complete output: virt-resize -v -x [...] Attaching output of the same command with -x -v. Created attachment 1057539 [details]
virt-builder output
Oh I see, I can reproduce it also using the --size 10G parameter. This seems to be a bug in sfdisk as far as I can tell. Here is a reproducer: $ rm -f disk.img $ truncate -s 4G disk.img $ fdisk disk.img Welcome to fdisk (util-linux 2.26.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0x81a5bda3. Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): e Partition number (1-4, default 1): First sector (2048-8388607, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-8388607, default 8388607): Created a new partition 1 of type 'Extended' and of size 4 GiB. Command (m for help): p Disk disk.img: 4 GiB, 4294967296 bytes, 8388608 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x81a5bda3 Device Boot Start End Sectors Size Id Type disk.img1 2048 8388607 8386560 4G 5 Extended Command (m for help): w The partition table has been altered. Syncing disks. ### Notice that the MBR type byte is 05: $ virt-filesystems -a disk.img --all --long -h Name Type VFS Label MBR Size Parent /dev/sda1 filesystem unknown - - 1.0K - /dev/sda1 partition - - 05 1.0K /dev/sda /dev/sda device - - - 4.0G - ### Now try setting the MBR type byte to 05. $ sfdisk --part-type /dev/sda 1 5 You cannot change a partition into an extended one or vice versa. Delete it first. sfdisk: /dev/sda: partition 1: failed to set partition type Bleah; the sfdisk command there was obviously wrong. However it still fails when I use the correct command: $ sfdisk --part-type disk.img 1 5 You cannot change a partition into an extended one or vice versa. Delete it first. sfdisk: disk.img: partition 1: failed to set partition type Fixed by upstream commit df15fb3d053716d03055df755911d66814054b4b. Thanks for your report! Note that with the bugfix you still cannot change type of the extended partition which is already used by nested logical partition(s), but your use-case works as expected: # sfdisk -ql /dev/sdc Device Boot Start End Sectors Size Id Type /dev/sdc1 2048 22527 20480 10M 83 Linux /dev/sdc2 22528 1023999 1001472 489M 83 Linux # sfdisk /dev/sdc --part-type 2 5 The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. # sfdisk -ql /dev/sdc Device Boot Start End Sectors Size Id Type /dev/sdc1 2048 22527 20480 10M 83 Linux /dev/sdc2 22528 1023999 1001472 489M 5 Extended The bugfix will be definitely in v2.27 (f23), is it necessary to backport it also to f22? It would be nice to have it in F22, but don't sweat it if it's a difficult backport. Thanks guys! util-linux-2.26.2-3.fc22 has been submitted as an update for Fedora 22. https://admin.fedoraproject.org/updates/util-linux-2.26.2-3.fc22 Package util-linux-2.26.2-3.fc22: * should fix your issue, * was pushed to the Fedora 22 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing util-linux-2.26.2-3.fc22' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2015-13513/util-linux-2.26.2-3.fc22 then log in and leave karma (feedback). util-linux-2.26.2-3.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report. *** Bug 1265078 has been marked as a duplicate of this bug. *** |