sfdisk fail on current Alpine
Recently util-linux
was upgraded in Alpine. I believe due of that resizing of partition on disk GPT table scheme start failing. This problem was introduced in the new Alpine release and impact current version of cloud-init (cc_growpart
module) and growpart.
Here is example log from current version of Alpine:
$ sfdisk -v
sfdisk from util-linux 2.35.1
$ sudo sfdisk --dump /dev/sda | sudo sfdisk --force /dev/sda
Checking that no-one is using this disk right now ... FAILED
This disk is currently in use - repartitioning is probably a bad idea.
Umount all file systems, and swapoff all swap partitions on this disk.
Use the --no-reread flag to suppress this check.
Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: F5232231-EC10-4243-B6D7-99568E629F11
Old situation:
Device Start End Sectors Size Type
/dev/sda1 2048 104447 102400 50M Linux filesystem
/dev/sda2 104448 206847 102400 50M Microsoft basic data
/dev/sda3 206848 2303999 2097152 1G Linux filesystem
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> line 7: unsupported command
New situation:
Disklabel type: gpt
Disk identifier: F5232231-EC10-4243-B6D7-99568E629F11
Device Start End Sectors Size Type
/dev/sda1 2048 104447 102400 50M Linux filesystem
/dev/sda2 104448 206847 102400 50M Microsoft basic data
/dev/sda3 206848 2303999 2097152 1G Linux filesystem
Leaving.
On similiar disk, but using Debian LiveCD on top of Alpine disk I have following log:
I have also old Alpine hosts where there is no issue like that:
$ sudo sfdisk --dump /dev/sda | sudo sfdisk --force /dev/sda
Checking that no-one is using this disk right now ... FAILED
This disk is currently in use - repartitioning is probably a bad idea.
Umount all file systems, and swapoff all swap partitions on this disk.
Use the --no-reread flag to suppress this check.
Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 7E05B9A2-C114-49AF-AB30-2E45DFD64AF6
Old situation:
Device Start End Sectors Size Type
/dev/sda1 2048 104447 102400 50M Linux filesystem
/dev/sda2 104448 206847 102400 50M Microsoft basic data
/dev/sda3 206848 20971486 20764639 9.9G Linux filesystem
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new GPT disklabel (GUID: 7E05B9A2-C114-49AF-AB30-2E45DFD64AF6).
/dev/sda1: Created a new partition 1 of type 'Linux filesystem' and of size 50 MiB.
Partition #1 contains a vfat signature.
/dev/sda2: Created a new partition 2 of type 'Microsoft basic data' and of size 50 MiB.
Partition #2 contains a vfat signature.
/dev/sda3: Created a new partition 3 of type 'Linux filesystem' and of size 9.9 GiB.
Partition #3 contains a ext4 signature.
/dev/sda4: Done.
New situation:
Disklabel type: gpt
Disk identifier: 7E05B9A2-C114-49AF-AB30-2E45DFD64AF6
Device Start End Sectors Size Type
/dev/sda1 2048 104447 102400 50M Linux filesystem
/dev/sda2 104448 206847 102400 50M Microsoft basic data
/dev/sda3 206848 20971486 20764639 9.9G Linux filesystem
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
Syncing disks.
vm-zen-proskuriakova:~$ sfdisk -v
sfdisk from util-linux 2.34