In openSUSE and SLES, the snapper tool automatically creates disk snapshots during software installation, uninstallation, and system configuration changes through YaST. These snapshots serve as a recovery point, allowing the system to be restored to a previous state if any issues occur. However, over time, these snapshots can accumulate and consume a significant amount of disk space.
To maintain optimal system performance, it's important to regularly delete unnecessary snapshots. The snapper tool in SUSE allows users to remove specific snapshots or a range of snapshots based on their needs. Managing these snapshots helps prevent the system from running out of disk space due to the buildup of unnecessary data.
The following steps outline how to effectively manage and delete snapshots in openSUSE and SLES using snapper. These steps ensure that your system remains efficient and free of excess snapshot data, which can slow down system performance.
Steps to delete disk snapshots in openSUSE and SLES:
- Open the terminal.
- List available snapper configurations.
> sudo snapper list-configs [sudo] password for root: Config | Subvolume -------+---------- root | /
- List the snapshots for the selected configuration.
> sudo snapper --config root list # | Type | Pre # | Date | User | Used Space | Cleanup | Description | Userdata ----+--------+-------+---------------------------------+------+------------+---------+-----------------------+-------------- 0 | single | | | root | | | current | 1* | single | | Mon 13 May 2019 10:56:13 AM +08 | root | 94.09 MiB | | first root filesystem | 2 | single | | Mon 13 May 2019 11:09:54 AM +08 | root | 35.94 MiB | number | after installation | important=yes 3 | pre | | Thu 23 May 2019 09:40:29 PM +08 | root | 1.30 MiB | number | zypp(zypper) | important=yes 4 | pre | | Thu 23 May 2019 09:55:34 PM +08 | root | 1.28 MiB | number | zypp(zypper) | important=yes 5 | post | 4 | Thu 23 May 2019 10:13:52 PM +08 | root | 79.21 MiB | number | | important=yes 6 | pre | | Sat 25 May 2019 10:54:26 PM +08 | root | 1.25 MiB | number | zypp(zypper) | important=yes 7 | pre | | Sat 25 May 2019 10:57:04 PM +08 | root | 912.00 KiB | number | yast repositories | 8 | post | 6 | Sat 25 May 2019 11:02:12 PM +08 | root | 14.52 MiB | number | | important=yes 9 | post | 7 | Sat 25 May 2019 11:02:38 PM +08 | root | 368.00 KiB | number | | 10 | pre | | Sat 25 May 2019 11:26:12 PM +08 | root | 236.00 KiB | number | zypp(zypper) | important=no 11 | post | 10 | Sat 25 May 2019 11:26:13 PM +08 | root | 340.00 KiB | number | | important=no
- Delete snapshot based on snapshot number.
> sudo snapper --config root delete 2
Using ranged parameter such as the following will delete snapshots numbered 1 to 10.
> sudo snapper --config root delete 1-10
Snapshot numbered 1 can't be deleted.
- Verify the deletion by listing the snapshots again.
> sudo snapper --config root list # | Type | Pre # | Date | User | Used Space | Cleanup | Description | Userdata ---+--------+-------+---------------------------------+------+------------+---------+-----------------------+--------- 0 | single | | | root | | | current | 1* | single | | Mon 13 May 2019 10:56:13 AM +08 | root | 30.93 MiB | | first root filesystem |
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Comment anonymously. Login not required.