Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
19
rated 0 times [  19] [ 0]  / answers: 1 / hits: 31811  / 2 Years ago, wed, october 19, 2022, 8:17:27

Being intrigued by btrfs I decided to toy around with it in a VM. Installation works great as long as I remember to put /boot on a separate partition and it all seems to work fine.



What I would like to do is create a separate subvolume for bulk data with different settings than things like @ and @home. btrfs subvolume create data will do that for me, but I'm curious why it keeps naming it @/data (or similar things when I try /data or @data). Is there a special way to create the subvolumes like @ and @home so my data subvolume will show up as @data? (and: what is the exact difference between the naming schemes?)






Additional information:




  • ubuntu 12.04.2, running as a KVM guest on mint15 host;

  • kernel 3.8.0-27-generic from ubuntu-x-swat (raring backport);

  • btrfs using two devices, /dev/sda and /dev/sdb

  • /dev/sda and /dev/sdb are partitions on a disk not used by the host OS


More From » 12.04

 Answers
4

Sigh, seems I posted a bit too soon, with a bit of help of the almighty Zosma on IRC, we found out how this is supposed to work.



Subvolumes @ and @home are children of the btrfs root, so / is not actually the root of the file system. The UUID of the btrfs root is supplied in /etc/fstab twice, providing the mounts for / and /home. Mounting the actual root of the file system shows the subvolumes created by the installer:



root@box:~# mkdir /mnt/btrfs
root@box:~# mount UUID=f8963df3-1320-4bc0-a125-62be185b029e /mnt/btrfs
root@box:~# ls /mnt/btrfs
@ @home


So that's where they went! Creating a new subvolume in the exact way the ubuntu installer did is now easy:



root@box:~# btrfs subvolume create /mnt/btrfs/@data
Create subvolume '/mnt/btrfs/@data'


Now, as we've created a subvolume in the btrfs root instead of in the root filesystem for the install, /data/ won't show up by itself. Luckily, it's trivial to copy the trick used by the installer by examining /etc/fstab and add another mount for /data:



UUID=f8963df3-1320-4bc0-a125-62be185b029e /data  btrfs  defaults,subvol=@data 0 2


Last step is to create the mount point: mkdir /data. After a reboot, we'll have a /data directory mounted from a separate btrfs subvolume.



… Profit!


[#29996] Thursday, October 20, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rstride

Total Points: 305
Total Questions: 112
Total Answers: 118

Location: Mali
Member since Sat, Dec 26, 2020
3 Years ago
;