how do i setup snapshots in tumbleweed for btrfs
[
OSTechNix
Create Btrfs Snapshots With Snapper In openSUSE - OSTechNix
[
reddit.com
Possible to take Btrfs snapshot of the /home subvolume in ... - Reddit
youtube
Unlock the Power of openSUSE Btrfs & Snapper - YouTube
+5
sources
Setting up snapshots in openSUSE Tumbleweed for Btrfs is relatively straightforward, as Snapper is integrated into the system by default. Here's how to set it up and use it effectively:
Default Configuration
By default, openSUSE Tumbleweed formats your hard drive with the Btrfs filesystem and sets up Snapper for the root filesystem5. This means you already have a basic snapshot configuration for your root directory.
Viewing and Creating Configurations
- View existing Snapper configurations:
bashsudo snapper list-configs
- If you need to create a new configuration for a specific subvolume (e.g., /home):
bashsudo snapper create-config /home
Creating Snapshots
- Automatic snapshots: Snapper is configured to automatically create timeline snapshots at regular intervals1.
- Manual snapshots: Create a snapshot with a description:
bashsudo snapper create --desc "Snapshot description"
Managing Snapshots
- List snapshots:
bashsudo snapper list
- Compare snapshots:
bashsudo snapper status 1..2
- Restore a snapshot:
For the root filesystem, you can usually boot into a snapshot from the GRUB menu4.
Tuning Snapper
To optimize Snapper's performance and disk usage:
- Edit the Snapper configuration file:
bashsudo nano /etc/snapper/configs/root
- Adjust the following parameters7:
- TIMELINE_LIMIT_HOURLY
- TIMELINE_LIMIT_DAILY
- TIMELINE_LIMIT_WEEKLY
- TIMELINE_LIMIT_MONTHLY
- TIMELINE_LIMIT_YEARLY
Additional Subvolumes
To set up snapshots for other subvolumes like /home:
- Verify if /home is a Btrfs subvolume:
bashsudo btrfs subvolume list /
- If it's a subvolume, create a Snapper configuration for it:
bashsudo snapper -c home create-config /home
- You can then manage snapshots for /home using the same commands as for root, specifying the configuration with -c home3.
Remember to regularly perform Btrfs maintenance tasks like balancing and scrubbing to ensure optimal filesystem performance6.
sudo snapper list-configs [sudo] password for root: Config │ Subvolume ───────┼────────── garyrust@unlimited:~> sudo snapper list The config 'root' does not exist. Likely snapper is not configured. See 'man snapper' for further instructions. garyrust@unlimited:~> sudo btrfs subvolume list / ID 256 gen 770 top level 5 path @ ID 257 gen 770 top level 256 path var ID 258 gen 700 top level 256 path usr/local ID 259 gen 697 top level 256 path srv ID 260 gen 724 top level 256 path root ID 261 gen 666 top level 256 path opt ID 262 gen 770 top level 256 path home ID 263 gen 35 top level 256 path boot/grub2/x86_64-efi ID 264 gen 697 top level 256 path boot/grub2/i386-pc garyrust@unlimited:~>
youtube
Unlock the Power of openSUSE Btrfs & Snapper - YouTube
[
manual.siduction.org
Btrfs and Snapper - Siduction Manual
[
OSTechNix
Create Btrfs Snapshots With Snapper In openSUSE - OSTechNix
+5
sources
Based on the output provided, it appears that Snapper is not configured on your openSUSE Tumbleweed system. However, your system is using Btrfs with several subvolumes. Here's how you can set up Snapper for Btrfs snapshots:
- First, create a Snapper configuration for the root subvolume:
bashsudo snapper create-config /
- This will create a new subvolume for snapshots and a configuration file. Verify the configuration:
bashsudo snapper list-configs
- You should now see a "root" configuration listed.
- To enable automatic snapshots, start and enable the snapper-timeline and snapper-cleanup services:
bashsudo systemctl enable --now snapper-timeline.timer
sudo systemctl enable --now snapper-cleanup.timer
- For other important subvolumes like /home, you can create additional configurations:
bashsudo snapper -c home create-config /home
- Verify that snapshots are being created:
bashsudo snapper list
Remember to adjust Snapper's configuration files in /etc/snapper/configs/ to set appropriate limits on the number of snapshots to keep, to prevent excessive disk usage13.
After setting up Snapper, you can use it to create, manage, and restore snapshots of your Btrfs subvolumes, providing an additional layer of data protection and system recovery options136.
sudo snapper create-config /var [sudo] password for root: Creating config failed (config already exists). garyrust@unlimited:~> sudo snapper list-configs Config │ Subvolume ───────┼────────── root │ / garyrust@unlimited:~>
youtube
Unlock the Power of openSUSE Btrfs & Snapper - YouTube
[
forums.opensuse
BTRFS Subvolumes and snapper - openSUSE Forums
[
OSTechNix
Create Btrfs Snapshots With Snapper In openSUSE - OSTechNix
+5
sources
The error indicates that Snapper is already configured for the /var subvolume. To proceed, you can verify and manage the existing configuration instead of creating a new one. Here's what you can do:
Verify Existing Configuration
- List Snapper configurations:
bashsudo snapper list-configs
This will show all existing configurations, including the one for /var.
Manage Snapshots for /var
If Snapper is already configured for /var, you can create, list, and manage snapshots using the following commands:
- Create a manual snapshot:
bashsudo snapper -c var create --desc "Manual snapshot for /var"
- List snapshots:
bashsudo snapper -c var list
- Restore a snapshot:
To restore a snapshot, use:
bashsudo snapper -c var undochange <snapshot_id>
Replace <snapshot_id> with the ID of the snapshot you want to restore.
Adjust Configuration Settings
If needed, you can modify the Snapper configuration for /var by editing its configuration file:
bashsudo nano /etc/snapper/configs/var
Adjust parameters like TIMELINE_LIMIT_HOURLY, TIMELINE_LIMIT_DAILY, etc., to control how many snapshots are retained.
Troubleshooting or Recreating Configuration
If you suspect issues with the current configuration and want to recreate it:
- Remove the existing configuration:
bashsudo snapper delete-config var
- Recreate the configuration:
bashsudo snapper create-config /var
This process ensures proper setup and management of snapshots for /var.
sudo snapper create-config /var Creating config failed (config already exists) here is my fstab. UUID=a1793935-e1da-43b4-948d-d2856237f92e / btrfs defaults 0 0 UUID=a1793935-e1da-43b4-948d-d2856237f92e /var btrfs subvol=/@/var 0 0 UUID=a1793935-e1da-43b4-948d-d2856237f92e /usr/local btrfs subvol=/@/usr/local 0 0 UUID=a1793935-e1da-43b4-948d-d2856237f92e /srv btrfs subvol=/@/srv 0 0 UUID=a1793935-e1da-43b4-948d-d2856237f92e /root btrfs subvol=/@/root 0 0 UUID=a1793935-e1da-43b4-948d-d2856237f92e /opt btrfs subvol=/@/opt 0 0 UUID=a1793935-e1da-43b4-948d-d2856237f92e /home btrfs subvol=/@/home 0 0 UUID=a1793935-e1da-43b4-948d-d2856237f92e /boot/grub2/x86_64-efi btrfs subvol=/@/boot/grub2/x86_64-efi 0 0 UUID=a1793935-e1da-43b4-948d-d2856237f92e /boot/grub2/i386-pc btrfs subvol=/@/boot/grub2/i386-pc 0 0 UUID=5E21-21AD /boot/efi vfat utf8 0 2
[
Oracle Help Center
Automating File System Snapshots With the Snapper Utility
[
unix.stackexchange
How to configure snapper for home (restore snapper config)
[
manual.siduction.org
Btrfs and Snapper - Siduction Manual
+5
sources
The error occurs because your /var is configured as a nested subvolume under the root Btrfs subvolume (@/var). Here's how to resolve this:
Key Issue
- Your
/varpath in fstab usessubvol=/@/var, making it a nested subvolume under the root (@) - Snapper requires top-level subvolumes for independent configurations
Solution Steps
- Delete existing invalid configuration:
bashsudo snapper delete-config var
- Convert nested subvolume to top-level:
bashsudo mv /var /var.old
sudo btrfs subvolume create /var
sudo cp -a /var.old/* /var/
sudo rm -rf /var.old
- Update fstab entry:
Change from:
bashUUID=... /var btrfs subvol=/@/var 0 0
To:
bashUUID=... /var btrfs subvol=/var,noatime,compress=zstd 0 0
- Create valid Snapper config:
bashsudo snapper -c var create-config /var
Verification
After these changes:
bashsudo snapper list-configs # Should now show 'var' config
sudo btrfs subvolume list / # Should show /var as top-level subvolume
Why This Works
Important: Ensure you have backups before modifying subvolume structures. The cp -a command preserves permissions and attributes during migration.
Related
How can I rename an existing Snapper configuration
What should I do if the Snapper configuration file is corrupted
How do I list all the Snapper configurations on my system
Can I automate the creation of Snapper configurations for multiple subvolumes
How do I revert to a previous snapshot using Snapper