Re: Recommended Partitioning & Subvolume Layout | Newbie Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23/04/2020 10:39, Stefanie Leisestreichler wrote:
> On 22.04.20 23:03, Chris Murphy wrote:
>> What's the gotcha? Well, my /var has been rolled back, and also the
>> systemd journal. OK so I could make /var/lib/libvirt and /var/log
>> subvolumes so they don't get snapshot and rolled back. What I tend to
>> do is put those in the top level of the file system, and have fstab
>> entries to mount them to the proper location during startup, that way
>> I don't have to worry about manually fixing things on a rollback.
> 
> Thanks for your time and answer.
> 
> I tend to lean on the fedora layout as far as my limited knowledge
> allows to calculate the impacts so far :-(
> 
> I do not understand what is meant by the statement:> What I tend to do
> is put those in the top level of the file system
> 
> I guess the storage for the snapshots is meant. So if I understand right
> you have a directory /snapshots in the dir tree where they will be
> stored. I know about the fact that a nested subvolume (subvolume in
> another subvolume) will not get snapshotted. But it is not clear to me
> if you are using this fact in your layout (make i.e. /var/log a separate
> subvolume) or not. Also it is not clear to me, why you put the snapshots
> in the top level of your filesystem.

I can't speak for Chris, who is much more experienced than I am. But
what I do (for all my btrfs filesystems, not just the root disk) is that
in the top level directory of the filesystem I only put subvolumes. No
files or ordinary directories. Those subvolumes are then mounted into
the correct places in the filesystem. The top level is mounted somewhere
else for maintenance activities.

So, for example, take my root disk. I create the filesystem, mount it
somewhere temporarily (let's say it is on /mnt/rootdisk) and create
subvoumes for /mnt/rootdisk/rootfs and /mnt/rootdisk/varfs. I also set
rootfs to be the default subvolume that is mounted if no subvolume is
specified.

I can then mount the filesystem somewhere else (say /mnt/newroot) by
mounting the rootfs subvolume, creating var as a directory and mounting
the varfs subvolume into that. That can then be installed in the normal way.

In the fstab on the new filesystem, I have entries like (leaving out
unimportant stuff):

LABEL=root / btrfs defaults,noatime,nodiratime
LABEL=root /var btrfs defaults,noatime,nodiratime,subvol=/varfs
LABEL=root /mnt/rootdisk btrfs defaults,noatime,nodiratime,subvolid=5

So, the result is that the root and /var appear set up as normal but the
actual filesystem toplevel directory is mounted at /mnt/rootdisk. This
is really useful if you want to be able to (temporarily or permanently)
replace one of those subvolumes with a different snapshot.

I do the same for data disks (so the top level is mounted at
/mnt/datadisk, the homefs subvolume is mounted at /home, the fred
subvolume is mounted at /home/fred, etc).




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux