All of lore.kernel.org
 help / color / mirror / Atom feed
From: Goffredo Baroncelli <kreijack@libero.it>
To: Andrei Borzenkov <arvidjaar@gmail.com>,
	Roman Mamedov <rm@romanrm.net>, Remi Gauvin <remi@georgianit.com>
Cc: Claudius Ellsel <claudius.ellsel@live.de>,
	linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: WG: How to properly setup for snapshots
Date: Mon, 21 Dec 2020 21:24:13 +0100	[thread overview]
Message-ID: <0d1a1fb0-f4c1-3207-cd04-b8f0cf97bddc@libero.it> (raw)
In-Reply-To: <3d45b062-a004-277e-db8b-6826c6b342bb@gmail.com>

On 12/21/20 7:26 PM, Andrei Borzenkov wrote:
> 21.12.2020 20:37, Roman Mamedov пишет:
[...]
> Having dedicated subvolume containing snapshots makes it easy to switch
> your root between subvolumes (either for roll back or transactional
> updates or whatever) and retain access to snapshots by simply mounting
> containing subvolume. Having them in subdirectory of your (root)
> subvolume means you can no more remove this subvolume without also
> destroying snapshots before, so you are stuck with it.
> 
> So it makes all sort of sense to think in advance and prepare dedicated
> subvolume for this purpose.

There is an asymmetry of the '/' subvolume; it can't be deleted, so it is not easy and cheap to swap it with its snapshot.

In my setup, I uses the '/' subvolume as container of all the other subvolumes, one of these is the root of my filesystem. Then each subvolume is mounted where it is needed:

$ findmnt  | egrep sdg3
/                                     /dev/sdg3[/@rootfs]       btrfs       rw,noatime,nodiratime,nossd,space_cache,subvolid=448,subvol=/@rootfs
├─/boot                               /dev/sdg3[/@boot]         btrfs       rw,noatime,nodiratime,nossd,space_cache,subvolid=258,subvol=/@boot
├─/var/btrfs                          /dev/sdg3                 btrfs       rw,noatime,nodiratime,nossd,space_cache,subvolid=5,subvol=/
├─/var/lib/machines/vm-sqlserver      /dev/sdg3[/@vm-sqlserver] btrfs       rw,noatime,nodiratime,nossd,space_cache,subvolid=454,subvol=/@vm-sqlserver
├─/var/lib/portables                  /dev/sdg3[/@portables]    btrfs       rw,noatime,nodiratime,nossd,space_cache,subvolid=282,subvol=/@portables
├─/var/log                            /dev/sdg3[/@log]          btrfs       rw,noatime,nodiratime,nossd,space_cache,subvolid=447,subvol=/@log

I mount the '/' subvolume under /var/btrfs, where i manage the subvolume. With this setup is easy to snapshot the root filesystem (/dev/sdg3[/@rootfs]) and mount the snapshot instead the old root. The other part of the filesystem which are better to not involve in the snapshot-rollback process (like /boot, /var/log...) are in a separate subvolumes which are mounted at boot time using /etc/fstab

I tough quite often that mkfs.btrfs should allow to create a "default" subvolume inside the '/'. It would simplify the management of the root filesystem in case if the user want to srollback the system to a previous snapshot.

BR

> 
>> not much of the "inside". Might as well just create a regular directory for
>> that -- and with less potential for confusion.
>>
>> * - keep in mind that "snapshot" and "subvolume" mean the same thing in Btrfs,
>>      the only difference being that "snapshot"-subvolume started its life as
>>      being a full copy(-on-write) of some other subvolume.
>>
> 


-- 
gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D  17B2 0EDA 9B37 8B82 E0B5

  parent reply	other threads:[~2020-12-21 20:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AM9P191MB165033908B55F8312178D90AE2CB0@AM9P191MB1650.EURP191.PROD.OUTLOOK.COM>
2020-12-21 16:11 ` WG: How to properly setup for snapshots Claudius Ellsel
2020-12-21 17:05   ` Remi Gauvin
2020-12-21 17:37     ` Roman Mamedov
2020-12-21 18:14       ` Remi Gauvin
2020-12-21 20:14         ` Goffredo Baroncelli
2020-12-21 20:27           ` Remi Gauvin
2020-12-21 20:52             ` Goffredo Baroncelli
2020-12-21 18:26       ` Andrei Borzenkov
2020-12-21 18:35         ` AW: " Claudius Ellsel
2020-12-21 18:40           ` Andrei Borzenkov
2020-12-21 20:51             ` AW: " Claudius Ellsel
2021-01-06 20:07               ` Ulli Horlacher
2020-12-21 20:24         ` Goffredo Baroncelli [this message]
2020-12-21 18:04     ` AW: WG: " Claudius Ellsel
2020-12-21 18:32       ` Remi Gauvin
2020-12-21 18:39         ` AW: " Claudius Ellsel
2020-12-21 20:45       ` Claudius Ellsel
2020-12-21 23:33         ` Graham Cobb
2020-12-22 15:19           ` AW: " Claudius Ellsel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0d1a1fb0-f4c1-3207-cd04-b8f0cf97bddc@libero.it \
    --to=kreijack@libero.it \
    --cc=arvidjaar@gmail.com \
    --cc=claudius.ellsel@live.de \
    --cc=kreijack@inwind.it \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=remi@georgianit.com \
    --cc=rm@romanrm.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.