I had to apply some tweaks, to get my goal:
I had previouslly created two btrfs subvolumes:
/home
/rootsys (Here, i wanted to put inside debian target installation)
0-I installed all together (the file system next to subvolumes) in the same parent level.
1- After syste, installation, I created a volume snaphot to put into it that installation:
cd /target
or
mount -t btrfs -o subvolid=0 /dev/sda1 /mnt
Code: Select all
btrfs subvolume delete /rootsys
btrfs subvolume snapshot ./ /rootsys
2- Clean/delete root installation outside subvolumes:
Code: Select all
mv /home .home
mv /rootsys .rootsys
rm -rf / (delete installation files outside snapshot rootsys)
mv .home /home
mv .rootsys /rootsys
3- Install Grub pointing to subvolume system (rootsys):
Code: Select all
mount --bind /dev /rootsys/dev
mount --bind /dev/pts /rootsys/dev/pts
mount --bind /proc /rootsys/proc
mount --bind /sys /rootsys/sys
chroot /rootsys
grub-install /dev/sda
update-grub
4- Editing fstab pointing to home subvolume:
btrfs subvolume list / (get ID subvolume home (649) for using in fstab)
Code: Select all
UUID=5a261bc5-1828-4588-b9a7-beb5f78a20e5 / btrfs defaults 0 1
UUID=5a261bc5-1828-4588-b9a7-beb5f78a20e5 /home/user/ btrfs subvolid=649 0 0