Score:0

What is .snapshot root directory in OpenSUSE Leap 15.4?

cn flag

I need to free disk space on a OpenSUSE Leap 15.4 server.

I notice I have a .snapshot directory at system's root:

srv-abc:~ # ll -h /
total 0
drwxr-x---   1 root root   36 Sep 14  2021 .snapshots
drwxr-xr-x   1 root root 1.8K Jan 26 13:50 bin
drwxr-xr-x   1 root root 1.2K Jan 26 13:58 boot
drwxr-xr-x  17 root root 4.0K Mar 19 22:54 dev
drwxr-xr-x   1 root root 5.0K Mar 19 22:54 etc
drwxr-xr-x   1 root root   44 Mar 15  2022 home
drwxr-xr-x   1 root root  100 Jan 26 13:15 lib
drwxr-xr-x   1 root root 3.0K Jan 26 13:52 lib64
drwxr-xr-x   1 root root    0 Mar 15  2022 mnt
drwxr-xr-x   1 root root   22 Mar 15  2022 opt
dr-xr-xr-x 245 root root    0 Mar  1 16:28 proc
drwx------   1 root root  370 Mar 20 17:03 root
drwxr-xr-x  40 root root 1.1K Mar 19 00:00 run
drwxr-xr-x   1 root root 4.1K Jan 26 13:52 sbin
drwxr-xr-x   1 root root    0 Mar 15  2022 selinux
drwxr-xr-x   1 root root   84 Mar  1 16:29 srv
dr-xr-xr-x  13 root root    0 Mar  1 16:28 sys
drwxrwxrwt   1 root root 123K Mar 20 17:15 tmp
drwxr-xr-x   1 root root  110 Mar 15  2022 usr
drwxr-xr-x   1 root root  120 Jan 26 13:50 var

srv-abc:~ # du -sh /.snapshots
3.4G    /.snapshots

I first thought about a snapper activity that would create snapshots but this option is disabled (USE_SNAPPER=no in /etc/sysconfig/yast2 file) and filesystem is not BTRFS.

srv-abc:~ # df -h
Filesystem                         Size  Used Avail Use% Mounted on
devtmpfs                           4.0M  8.0K  4.0M   1% /dev
tmpfs                              985M     0  985M   0% /dev/shm
tmpfs                              394M   26M  369M   7% /run
tmpfs                              4.0M     0  4.0M   0% /sys/fs/cgroup
/dev/sda2                           14G   13G  574M  96% /
/dev/sda2                           14G   13G  574M  96% /.snapshots
/dev/sda2                           14G   13G  574M  96% /boot/grub2/x86_64-efi
/dev/sda2                           14G   13G  574M  96% /boot/grub2/i386-pc
/dev/sda2                           14G   13G  574M  96% /opt
/dev/sda2                           14G   13G  574M  96% /home
/dev/sda2                           14G   13G  574M  96% /var
/dev/sda2                           14G   13G  574M  96% /usr/local
/dev/sda2                           14G   13G  574M  96% /srv
/dev/sda2                           14G   13G  574M  96% /tmp
/dev/sda2                           14G   13G  574M  96% /root
//srv-file.domain.fr/Procedures    3.1T  2.8T  348G  90% /srv/www/htdocs/public/files
tmpfs                              197M     0  197M   0% /run/user/1001

Is this .snapshot directory necessary and can I confidently remove/empty it?

-- EDIT --

The filesystem is indeed BTRFS:

srv-abc:~ # mount
/dev/sda2 on /.snapshots type btrfs (rw,relatime,space_cache,subvolid=267,subvol=/@/.snapshots)
/dev/sda2 on /boot/grub2/x86_64-efi type btrfs (rw,relatime,space_cache,subvolid=265,subvol=/@/boot/grub2/x86_64-efi)
/dev/sda2 on /boot/grub2/i386-pc type btrfs (rw,relatime,space_cache,subvolid=266,subvol=/@/boot/grub2/i386-pc)
/dev/sda2 on /opt type btrfs (rw,relatime,space_cache,subvolid=263,subvol=/@/opt)
/dev/sda2 on /home type btrfs (rw,relatime,space_cache,subvolid=264,subvol=/@/home)
/dev/sda2 on /var type btrfs (rw,relatime,space_cache,subvolid=258,subvol=/@/var)
/dev/sda2 on /usr/local type btrfs (rw,relatime,space_cache,subvolid=259,subvol=/@/usr/local)
/dev/sda2 on /srv type btrfs (rw,relatime,space_cache,subvolid=261,subvol=/@/srv)
/dev/sda2 on /tmp type btrfs (rw,relatime,space_cache,subvolid=260,subvol=/@/tmp)
/dev/sda2 on /root type btrfs (rw,relatime,space_cache,subvolid=262,subvol=/@/root)

Here is the snapper's snapshots list:

srv-abc:~ # snapper -c root list
 # | Type   | Pre # | Date                     | User | Used Space | Cleanup | Description                        | Userdata
---+--------+-------+--------------------------+------+------------+---------+------------------------------------+---------
0  | single |       |                          | root |            |         | current                            |
1* | single |       | Fri Oct 12 14:13:54 2018 | root |   3.29 GiB |         | premier système de fichiers racine |

Can I remove snapshot ID 1* safely?

Score:1
in flag

BTRFS is the default file system for OpenSUSE Leap 15.4

The repeated /dev/sda2 entries in the df output also suggest that your system is using btrfs and btrfs subvolumes.

If the filesystem is not btrfs then what file system is used?
Check for example the output of mount.

See for example https://doc.opensuse.org/documentation/leap/reference/html/book-reference/cha-expert-partitioner.html#sec-yast-btrfs

The default file system for the root partition is Btrfs. ... The root file system is the default subvolume and it is not listed in the list of created subvolumes

It is possible to create snapshots of Btrfs subvolumes—either manually, or automatically based on system events. For example when making changes to the file system, zypper invokes the snapper command to create snapshots before and after the change. This is useful if you are not satisfied with the change zypper made and want to restore the previous state. As snapper invoked by zypper creates snapshots of the root file system by default,

Note Setting USE_SNAPPER to no in /etc/sysconfig/yast2 does not completely disable the BTRFS snapshot capability, it will only prevent yast from creating snapshots when making administrative changes. Timeline and installation snapshots will still be enabled.

See https://documentation.suse.com/sles/12-SP4/html/SLES-all/cha-snapper.html#sec-snapper-setup-customize-auto-snapshots

wiltomap avatar
cn flag
Thanks @HBruijn for answer and documentation! You are right, the `mount` command returns BTRFS for `/dev/sda2`. I edited my post this way and gave some more information about snapper's existing snapshots.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.