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

Debian Btrfs: subvolume layout best practice



Hi!  I use Btrfs on Dell Inspiron 5570 laptop with 16 GiB RAM, a 1 TB
SATA HDD and an M.2 NVMe 250 GB SSD---a Western Digital WD Blue SN550
rated for 150 TBW.  I have read a lot on subvolume layout and, inspired
partly by [1], laid out subvolumes according to this fstab excerpt:
    1: https://en.opensuse.org/SDB:BTRFS "SDB:BTRFS - openSUSE Wiki"

LABEL=SSD /                  btrfs noatime,space_cache=v2,compress-force=zstd:12,subvol=@rootfs    0       0
LABEL=SSD /var/              btrfs noatime,space_cache=v2,compress-force=zstd:12,subvol=@var       0       0
LABEL=HDD /var/log           btrfs noatime,space_cache=v2,compress=zstd:12,subvol=@var-log         0       0
LABEL=HDD /var/cache/apt/archives btrfs noatime,space_cache=v2,compress=zstd:12,subvol=@apt-archives   0   0
LABEL=SSD /root              btrfs noatime,space_cache=v2,compress-force=zstd:12,subvol=@~root     0       0
LABEL=SSD /home/jorge        btrfs noatime,space_cache=v2,compress-force=zstd:12,subvol=@~jorge    0       0
LABEL=SSD /home/jorge/.cache btrfs noatime,space_cache=v2,compress-force=zstd:12,subvol=@~jorge-.cache 0   0
LABEL=HDD /home/jorge/HDD    btrfs noatime,space_cache=v2,compress=zstd:12,subvol=@~jorge          0       0
LABEL=SSD /home/wanessa      btrfs noatime,space_cache=v2,compress-force=zstd:12,subvol=@~wanessa  0       0
LABEL=HDD /home/wanessa/HDD  btrfs noatime,space_cache=v2,compress=zstd:12,subvol=@~wanessa        0       0
LABEL=SSD /gnu               btrfs noatime,space_cache=v2,compress-force=zstd:12,subvol=@gnu-store 0       0
LABEL=SSD /usr/local         btrfs noatime,space_cache=v2,compress-force=zstd:12,subvol=@usr-local 0       0

I have tmpfs on /tmp via the systemd unit.  I know that zstd:12 looks
overkill, but performance is still pretty good.  Besides, after the
system has settled I will reduce the compression level, combining the
performance of moderate compression with the space saving of zstd:12, as
most data will have already been written.

Two questions:
1. Should /var really be segregated?

   *After* segregating /var into its own subvolume¹, I realized this
   could cause inconsistency on system rollbacks.  I don't known about
   openSUSE's package manager, but AFAIK Debian's dpkg stores important
   state in /var, particularly /var/lib.  Thus I fear that if I snapshot
   @rootfs and @var at different times, then rolling back @rootfs and
   @var could confuse dpkg.  Should I then
   a) Before rolling back @rootfs and @var, remember to verify they were
   snapshotted at very close moments?  Or
   b) change my subvolume layout?  How exactly?

   With option a, the only benefit of segregating /var is that I could
   snapshot @rootfs, backup that snapshot, and then delete that snapshot
   without the space waste of snapshotting /var too.  After all, I only
   backup (parts of) /home and /etc.  I would snapshot /var on other
   occasions only.

2. Should I segregate /boot/grub2/x86_64-efi?

   Should I segregate /boot/grub2/x86_64-efi into its own subvolume as
   openSUSE does?

Footnotes
¹ And /var/log into yet another subvolume (on the HDD).

Regards,

-- 
- Many people hate injustice but few check the facts; this causes more
  injustice.  Ask me about <https://stallmansupport.org>
- I am Brazilian.  I hope my English is correct and I welcome feedback.
- Free Software Supporter: https://www.fsf.org/free-software-supporter
- If an email of mine arrives at your spam box, please notify me.


Reply to: