[Solved] btrfs subvolume target installation

Kernels & Hardware, configuring network, installing services

[Solved] btrfs subvolume target installation

Postby bester69 » 2017-04-11 20:48

Hi,
How can i install debian filesystem over a subvolume btrfs with debian's CD installation?

I tried to mount subvolume in /target directory as i usaully do with sparky distro (debian based on), but the wizard installation automatic unmount the subvolume just before to proceed with the files copy installation..and it copies all files in the / (main subvolume).

I wanted something like that:
Code: Select all
mount -t btrfs -o subvolid=xxx /dev/sda1 /target

so, the installation process, use the subvolume xxx for installation.


thanks.
Last edited by bester69 on 2017-04-12 17:03, edited 1 time in total.
User avatar
bester69
 
Posts: 776
Joined: 2015-04-02 13:15

Re: btrfs subvolume target installation

Postby bester69 » 2017-04-12 16:58

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
User avatar
bester69
 
Posts: 776
Joined: 2015-04-02 13:15

Re: btrfs subvolume target installation

Postby pylkko » 2017-04-12 19:29

Were you using the stable installer or does not even the RC one support btrfs install straight out-of-the-box?
User avatar
pylkko
 
Posts: 844
Joined: 2014-11-06 19:02

Re: btrfs subvolume target installation

Postby bester69 » 2017-04-12 21:24

pylkko wrote:Were you using the stable installer or does not even the RC one support btrfs install straight out-of-the-box?

I used testing netinst-distro,
Hi pylkko, thanks for ans.

It let you to pick a btrfs partition, but it doesnt let you to choose a subvolume in that partition, so i found it kind of extrange. So i came here to see if i was missleading something.
User avatar
bester69
 
Posts: 776
Joined: 2015-04-02 13:15

Re: btrfs subvolume target installation

Postby pylkko » 2017-04-13 13:52

maybe bug report it?
User avatar
pylkko
 
Posts: 844
Joined: 2014-11-06 19:02

Re: btrfs subvolume target installation

Postby bester69 » 2017-04-14 16:27

pylkko wrote:maybe bug report it?

I think, that's part of the wizard debian standard installation. there should be something in partition stage menu, when you choose a btrfs partition, you shoud be able to choose a subvolume.

Anyways not a big problem, now that i know i can snaphot the root installation into a subvolume.
User avatar
bester69
 
Posts: 776
Joined: 2015-04-02 13:15

Re: [Solved] btrfs subvolume target installation

Postby Head_on_a_Stick » 2017-04-16 11:41

I don't know about the Debian installer but I have just installed Debian stretch to a btrfs formatted partiton (/dev/sda8 in this case, mutatis mutandis) in a multiboot laptop with a simple custom (flat) layout using this sequence from a "live" ISO image:
Code: Select all
# mkfs.btrfs /dev/sda8
# mount /dev/sda8 /mnt
# btrfs subvolume create /mnt/stretch
# btrfs subvolume create /mnt/home
# umount -R /mnt
# mount -o subvol=stretch,compress=lzo /dev/sda8 /mnt
# mount -o subvol=home,compress=lzo /dev/sda8 /mnt/home
# debootstrap stretch /mnt http://cdn-fastly.deb.debian.org/debian

Then chroot into the system and configure it as per https://www.debian.org/releases/jessie/ ... 03.html.en

Pro tip: for the system clock, use this to set UTC:
Code: Select all
# hwclock --systohc

This will create the /etc/adjtime template file ;)

EDIT: be sure to set the custom mount options correctly in /etc/fstab before rebooting into the installed system; for my system it would be:
Code: Select all
/dev/sda8 / btrfs rw,compress=lzo,space_cache,subvol=stretch 0 0
/dev/sda8 /home btrfs rw,compress=lzo,space_cache,subvol=home 0 0
“Such is modern computing: everything simple is made too complicated because it’s easy to fiddle with; everything complicated stays complicated because it’s hard to fix." — Rob Pike

Please read before posting How to report a problem
User avatar
Head_on_a_Stick
 
Posts: 6413
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: [Solved] btrfs subvolume target installation

Postby bester69 » 2017-04-16 20:57

Head_on_a_Stick wrote:I don't know about the Debian installer but I have just installed Debian stretch to a btrfs formatted partiton (/dev/sda8 in this case, mutatis mutandis) in a multiboot laptop with a simple custom (flat) layout using this sequence from a "live" ISO image:
Code: Select all
# mkfs.btrfs /dev/sda8
# mount /dev/sda8 /mnt
# btrfs subvolume create /mnt/stretch
# btrfs subvolume create /mnt/home
# umount -R /mnt
# mount -o subvol=stretch,compress=lzo /dev/sda8 /mnt
# mount -o subvol=home,compress=lzo /dev/sda8 /mnt/home
# debootstrap stretch /mnt http://cdn-fastly.deb.debian.org/debian

Then chroot into the system and configure it as per https://www.debian.org/releases/jessie/ ... 03.html.en

Pro tip: for the system clock, use this to set UTC:
Code: Select all
# hwclock --systohc

This will create the /etc/adjtime template file ;)

EDIT: be sure to set the custom mount options correctly in /etc/fstab before rebooting into the installed system; for my system it would be:
Code: Select all
/dev/sda8 / btrfs rw,compress=lzo,space_cache,subvol=stretch 0 0
/dev/sda8 /home btrfs rw,compress=lzo,space_cache,subvol=home 0 0


I take note of it, thanks a lot.
User avatar
bester69
 
Posts: 776
Joined: 2015-04-02 13:15


Return to System configuration

Who is online

Users browsing this forum: No registered users and 10 guests

fashionable