[Bug 1947311] Re: Unexpected partition growth on first boot on impish for raspberry pi
Scott Moser
1947311 at bugs.launchpad.net
Wed Feb 16 15:54:20 UTC 2022
@Noah,
The image you pointed at there has the package 'cloud-initramfs-growroot'
in its initramfs. cloud-initramfs-growroot is going to run growpart on the
root filesystem during the initramfs unless one of the following files
exists on the root filesystem:
/var/lib/cloud/instance/root-grown
/etc/growroot-disabled
/etc/growroot-grown
So the easiest to do is to create one of those files. You have mentioned
above that MacOS does not have ext4 filesystem support. So you can't easily
do it natively.
Here are some other options:
1. use libguestfs/guestfish or some other mechanism to boot a linux in which
you could create one of those files.
2. Improve growpart to read a kernel command line option to disable
itself.
3. Improve growpart to further look for a "disable" file on a vfat
filesystem labelled 'system-boot' (lets just say 'growroot-disabled'), and
then use MacOS support of vfat to create the file there.
4. Further partition the image before booting. Growpart can only grow the
root filesystem until the next partition boundary.
Further exploring option '4', here is some information about the image:
a.) there are 2 partitions,
* 1 : 256M partition with VFAT filesystem labelled 'system-boot'.
* 2 : ~3.9GB partition with ext4 filesystem labelled 'writable'
b.) there is 16676864 bytes of unpartitioned space after partition 2.
c.) These are just rants:
* The second partition starts on a MiB boundary, but does not end on one.
So when you create another partition on that disk you're likely
* The partition table type really should be GPT, not dos. 10 years ago
GPT would have been the right decision and it still is today.
* I wonder why 16676864 bytes (32572 sectors) of unused space. that is an
strange number.
So something you probably can do is to add a partition of minimal size
directly after the last partition. You could use fdisk to do this
interactively or sfdisk like below:
If I were trying to do this right, I'd end my mini-partition on a MiB
boundary so that the fourth partition would start on a MiB boundary.
MiB boundary just make sense for alignment (or even 4MiB boundary, for
LVM extent alignment. Maybe it isn't completely necessary, but why not?).
But for simplicitly sake, lets just add a partition right at the end of the
previous one.
Info is attached and at https://paste.ubuntu.com/p/SmQKM2qCXX/ .
Below is the fdisk session inline here (launchpad doesn't format things
like that well, so I put it in attachemnt and pastebin also).
The end result is we have a partition (number 4) that starts right where
the second partition ends, so that:
a.) you can use partition 3 as you wanted before.
b.) growpart can't grow anything.
-----
$ fdisk jammy-preinstalled-server-arm64+raspi.img
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk jammy-preinstalled-server-arm64+raspi.img: 4.18 GiB, 4483710976 bytes, 8757248 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: 0x755644c9
Device Boot Start End Sectors Size Id Type
jammy-preinstalled-server-arm64+raspi.img1 * 2048 526335 524288 256M c W95
jammy-preinstalled-server-arm64+raspi.img2 526336 8722627 8196292 3.9G 83 Linu
Command (m for help): n
Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3): 4
First sector (8722628-8757247, default 8724480): 8722628
Last sector, +/-sectors or +/-size{K,M,G,T,P} (8722628-8757247, default 8757247): +2047
Created a new partition 4 of type 'Linux' and of size 1 MiB.
Command (m for help): w
The partition table has been altered.
Syncing disks.
** Attachment added: "info.txt : disk layout info and partitioning"
https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1947311/+attachment/5561442/+files/info.txt
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to ubuntu-image in Ubuntu.
https://bugs.launchpad.net/bugs/1947311
Title:
Unexpected partition growth on first boot on impish for raspberry pi
Status in cloud-init package in Ubuntu:
Incomplete
Status in linux-raspi package in Ubuntu:
Invalid
Status in ubuntu-image package in Ubuntu:
New
Bug description:
Hi,
On Raspberry Pi since Impish, the partition always grows even if I set
the following in user-data of cloud-init.
growpart:
mode: off
devices: ['/']
I have tested this on 21.04, and it works, but is broken on 21.10.
(partition always grows)
I've also tested this in KVM on amd64, and it works (partition does
NOT grow).
This is a problem for me because I am using runcmd in cloud init to
migrate my drive to LVM/LUKS, and the partitioning step fails because
the drive is already full.
Cheers,
Noah
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1947311/+subscriptions
More information about the foundations-bugs
mailing list