[systemd-devel] User configs, BTRFS subvolume for /home and automatic service start during boot?
Julian Andres Klode
jak at debian.org
Fri May 4 18:55:48 UTC 2018
On Fri, May 04, 2018 at 07:03:59PM +0200, Lennart Poettering wrote:
> On Fr, 04.05.18 18:59, Thorsten Schöning (tschoening at am-soft.de) wrote:
>
> > Guten Tag Lennart Poettering,
> > am Freitag, 4. Mai 2018 um 18:07 schrieben Sie:
> >
> > > Hmm, you said /home was a subvolume? That suggests they are on the
> > > same fs? Not following here?
> >
> > I guess "/etc/fstab" is clearer than my explanation:
> >
> > > # <file system> <mount point> <type> <options> <dump> <pass>
> > > # / was on /dev/sda1 during installation
> > > UUID=0841ef72-e9d4-45ca-af22-a403783859c6 / btrfs noatime,nodiratime,subvol=@ 0 1
> > >
> > > # /home was on /dev/sda1 during installation
> > > UUID=0841ef72-e9d4-45ca-af22-a403783859c6 /home btrfs noatime,nodiratime,subvol=@home 0 2
> >
> > So the same BTRFS file system containing two sub volumes. That seems
> > to work for user configs, my problem was a wrong "WantedBy".
>
> Note that btrfs subvolumes are just special directories, hence you can
> also do without an explicit entry for the home subvol, and simply
> create it below the root subvol.
That's not the best advise IMO. Subvolumes inside subvolumes have
weird behavior that sometimes bites you very hard. For example:
You can't restore an older / snapshot because it won't contain
your /home because it's a subvolume of the current /, but not of the
snapshot. It's just going to be a pain if you forget that.
I had this problem with lxd - it keeps containers in a btrfs subvolume
below /, and then I restored / to an older snapshot and all my containers
were gone / broken - I had to recreate them, as I only noticed later and
already had deleted my broken old "/"; so I switched to a mount for
them:
/dev/mapper/ubuntu--vg-root /var/snap/lxd/common/lxd/storage-pools/default btrfs defaults,subvol=@lxd 0 2
For Ubuntu, it's worth noting that the @ subvolume that's mounted to / is automatically
snapshotted when upgrading distributions; or even on normal upgrades with apt-btrfs-snapshot.
--
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer i speak de, en
More information about the systemd-devel
mailing list