Bug 13608 - BTRFS subvolume layout
Summary: BTRFS subvolume layout
Status: NEW
Alias: None
Product: IPFire
Classification: Unclassified
Component: --- (show other bugs)
Version: 2
Hardware: unspecified Unspecified
: - Unknown - - Unknown -
Assignee: Assigned to nobody - feel free to grab it and work on it
QA Contact:
URL:
Keywords:
Depends on:
Blocks: BTRFS
  Show dependency treegraph
 
Reported: 2024-03-03 18:08 UTC by Stefan Schantl
Modified: 2024-05-31 10:24 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Schantl 2024-03-03 18:08:25 UTC
We need to design a subvolume layout in case BTRFS is used.

A good layout is necessary because in case a snapshot of the root filesystem will be restored all kind of different data files, for example log files, databases, mail queues etc also will will be set back to the snapshoted state.

This mostly will result in a massively data lost. If those data is stored on a different subvolume than the root filesystem, those data would not be part of a snapshot and keeps untouched during a roll-back

Currently the following subvolumes are created by the installer:
(https://git.ipfire.org/?p=people/stevee/ipfire-2.x.git;a=blob;f=src/installer/hw.c;h=26c473e9c42a3941f9a293f49c3ee5f5083ba418;hb=refs/heads/next-BTRFS#l47)

@root      | /           | Which contains the root filesystem
@snapshots | /.snapshots | The subvolume where the snapshots will be stored
@home      | /home       | Contains the user homes (may not required)
@cache     | /var/cache  | Contains various cached files
@lib       | /var/lib    | Folder which contains a lot of different databases (suricata, libloc etc)
@logs      | /var/log    | Contains the log files, which never should be rolled back.
@mails     | /var/mail   | Directory for system mails
@tmp       | /var/tmp    | Folder which contains temporary downloaded files (no snaphotting needed for them)

Please feel free to add any forgotten system directories which contains any kind of data which never should be rolled back.
Comment 1 Stefan Schantl 2024-03-03 18:13:01 UTC
I had a phone call to Arne about this topic and he mentioned the following directories as well:

* /root ( because of the bash history)
* /var/backup ( IMPORTANT )
* The directory which keeps the RRD graphs
* The direcotry which holds the vnstat DB
* The directory which contains the OVPN one time pad key ( OVPN OTA )
Comment 2 Stefan Schantl 2024-03-15 18:37:58 UTC
* RRD graphs are placed in "/var/log/rrd"
* vnstats are located in "/var/log/vnstat"

So there is no need to place them on an own subvolume because "/var/log" is already one.

OVPN one time pad key ( OVPN OTA ) is not needed because we do not use the incremented file approach.
Comment 3 c Farley 2024-05-18 18:36:47 UTC
(In reply to Stefan Schantl from comment #0)
> We need to design a subvolume layout in case BTRFS is used.
> 
> A good layout is necessary because in case a snapshot of the root filesystem
> will be restored all kind of different data files, for example log files,
> databases, mail queues etc also will will be set back to the snapshoted
> state.
> 
> This mostly will result in a massively data lost. If those data is stored on
> a different subvolume than the root filesystem, those data would not be part
> of a snapshot and keeps untouched during a roll-back
> 
> Currently the following subvolumes are created by the installer:
> (https://git.ipfire.org/?p=people/stevee/ipfire-2.x.git;a=blob;f=src/
> installer/hw.c;h=26c473e9c42a3941f9a293f49c3ee5f5083ba418;hb=refs/heads/next-
> BTRFS#l47)
> 
> @root      | /           | Which contains the root filesystem
> @snapshots | /.snapshots | The subvolume where the snapshots will be stored
> @home      | /home       | Contains the user homes (may not required)
> @cache     | /var/cache  | Contains various cached files
> @lib       | /var/lib    | Folder which contains a lot of different
> databases (suricata, libloc etc)
> @logs      | /var/log    | Contains the log files, which never should be
> rolled back.
> @mails     | /var/mail   | Directory for system mails
> @tmp       | /var/tmp    | Folder which contains temporary downloaded files
> (no snaphotting needed for them)
> 
> Please feel free to add any forgotten system directories which contains any
> kind of data which never should be rolled back.

You may want to add @srv because /srv is common used for www and nfs.
Comment 4 Michael Tremer 2024-05-31 10:24:07 UTC
(In reply to c Farley from comment #3)
> You may want to add @srv because /srv is common used for www and nfs.

This might be difficult because we have the web UI files in /srv which should be part of the rollback.