bootc icon indicating copy to clipboard operation
bootc copied to clipboard

`/home` partition or LVM logvol will be dropped and ignored after `bootc install to-existing-root`

Open henrywang opened this issue 1 year ago • 5 comments

If the system has a dedicated /home partition or LVM logvol, this part of disk will be dropped/ignored after bootc install to-existing-root. This part of disk will not be used by bootc system. For example: This is the system df output before bootc install to-existing-root.

    Filesystem                                       Type      Size  Used Avail Use% Mounted on
    devtmpfs                                         devtmpfs  4.0M     0  4.0M   0% /dev
    tmpfs                                            tmpfs     251G     0  251G   0% /dev/shm
    tmpfs                                            tmpfs     101G   12M  101G   1% /run
    efivarfs                                         efivarfs  512K  6.7K  506K   2% /sys/firmware/efi/efivars
    /dev/mapper/cs_ampere--mtjade--altramax--01-root xfs        70G  2.5G   68G   4% /
    /dev/nvme0n1p2                                   xfs       960M  201M  760M  21% /boot
    /dev/nvme0n1p1                                   vfat      599M  7.0M  592M   2% /boot/efi
    /dev/mapper/cs_ampere--mtjade--altramax--01-home xfs       819G  5.8G  813G   1% /home
    tmpfs                                            tmpfs      51G     0   51G   0% /run/user/0
    tmpfs                                            tmpfs      51G  4.0K   51G   1% /run/user/1000

This is the system df output after bootc install. Almost 800G disk space will not be used.

    Filesystem                                       Type      Size  Used Avail Use% Mounted on
    devtmpfs                                         devtmpfs  4.0M     0  4.0M   0% /dev
    tmpfs                                            tmpfs     251G     0  251G   0% /dev/shm
    tmpfs                                            tmpfs     101G   12M  101G   1% /run
    efivarfs                                         efivarfs  512K  6.6K  506K   2% /sys/firmware/efi/efivars
    /dev/mapper/cs_ampere--mtjade--altramax--01-root xfs        70G  5.4G   65G   8% /sysroot
    overlay                                          overlay   7.3M  7.3M     0 100% /
    /dev/nvme0n1p2                                   xfs       960M   56M  905M   6% /boot
    tmpfs                                            tmpfs     251G   96K  251G   1% /tmp
    tmpfs                                            tmpfs      51G     0   51G   0% /run/user/1000

Disk partition info:

    Disk /dev/nvme0n1: 894.25 GiB, 960197124096 bytes, 1875385008 sectors
    Disk model: SAMSUNG MZ1LB960HAJQ-00007
    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: gpt
    Disk identifier: 6A257643-7710-49F0-A752-0FD78B25237E
  
    Device           Start        End    Sectors   Size Type
    /dev/nvme0n1p1    2048    1230847    1228800   600M EFI System
    /dev/nvme0n1p2 1230848    3327999    2097152     1G Linux filesystem
    /dev/nvme0n1p3 3328000 1875384319 1872056320 892.7G Linux LVM
  
  
    Disk /dev/mapper/cs_ampere--mtjade--altramax--01-root: 70 GiB, 75161927680 bytes, 146800640 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
  
  
    Disk /dev/mapper/cs_ampere--mtjade--altramax--01-swap: 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
  
  
    Disk /dev/loop0: 7.29 MiB, 7643136 bytes, 1866 sectors
    Units: sectors of 1 * 4096 = 4096 bytes
    Sector size (logical/physical): 4096 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
  
  
    Disk /dev/zram0: 8 GiB, 8589934592 bytes, 2097152 sectors
    Units: sectors of 1 * 4096 = 4096 bytes
    Sector size (logical/physical): 4096 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
  
  
    Disk /dev/mapper/cs_ampere--mtjade--altramax--01-home: 818.66 GiB, 879033843712 bytes, 1716862976 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

henrywang avatar May 09 '24 03:05 henrywang

This is currently expected...I wouldn't call it a bug. But, what exactly we take from the target root with install to-existing-root is clearly not very intuitive. Longer term we probably need to get to a state where we either inherit more (including things like ssh keys, etc.) or less (by always blowing away the root).

cgwalters avatar May 23 '24 00:05 cgwalters

Yeah, I agree it's not a bug but one of installation scenarios. The autopart in kickstart will give /home a very big space of the disk. So I filed this scenario here.

henrywang avatar May 23 '24 11:05 henrywang

A similar issue I encountered when running install to-existing-root from a standard Fedora Workstation install which uses a btrfs subvolume for /home, the home subvolume was taking up the majority of the bootc system space until I deleted it. Maybe system-reinstall-bootc could help with this via a prompt. Maybe we can start with just adding a prompt that lists existing mounts/volumes/partitions/etc. and explain they will need to be cleaned up after the install or mounted from the bootc image.

ckyrouac avatar Apr 28 '25 15:04 ckyrouac

Initially I felt a bit uncertain if conceptually this problem domain falls within s-r-b or bootc install. But upon some reflection I'd say it's a feature that bootc install to-existing-root is conceptually simplistic; and since we have s-r-b we can put things like this there to start at least.

Maybe we can start with just adding a prompt that lists existing mounts/volumes/partitions/etc. and explain they will need to be cleaned up after the install or mounted from the bootc image.

Hmm yes, I think we could implement this by scanning .mount units and finding ones that are mounted on the existing root.

But they don't necessarily need to be cleaned up! In some cases we may want to actually preserve data across those, and /home is a great example of that.

We have a lot of warnings about clearing out the existing operating system, but things get dicier when we scope in other partitions - we especially need to be wary about network filesystems.

I would say it needs to be a decision made for each mount:

  • Ignore
  • delete fully (i.e. actually deallocate the LV/subvolume)
  • empty (remove all contents, but keep the LV/subvolume)

The use case for "empty" is when you want to go from Fedora Workstation in package mode to Fedora Workstation in image mode, and you do want to keep that subvolume initialized. The use case for "delete fully" is the opposite; say you had /var/log as a separate partition before but you don't care about carrying that forward.


Mmmm...another big thing to consider here is anything done in s-r-b we definitely want to support automating in the general case. So it'd make sense to look at prior art for that like repart and Ignition and kickstarts.

(And scoping in some of those, especially kickstarts brings with it the much larger question of how much we do on this versus trying to do anaconda-in-container as mentioned in https://github.com/rhinstaller/anaconda/discussions/5888 )

cgwalters avatar Apr 28 '25 16:04 cgwalters

From my understanding, bootc install is OS installation, not OS upgrade. That should be the delete case. The empty case = delete case + re-partition. bootc or bootc submodule might need support partition feature. This will create a closed-loop system for image mode. I mean "give me a disk, and I'll return you a system" :-)

henrywang avatar Apr 29 '25 01:04 henrywang