Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to modify the default installation directory of Snap in Centos7?

Shulou Source: shulou.com Published: 2022-06-03 06:02:10 11月14日 Update

How to modify the default installation directory of Snap in Centos7? In order to solve this problem, today the editor summarizes this article to modify the default installation directory of Snap, hoping to help more friends who want to solve this problem to find a more simple and easy way.

Description

Recently received the company server alarm message, mount=/var/lib/snapd/snap/core/8592 100 > = 90. This is because the installation of Snap takes up disk space (the default installation directory is / var/lib/snapd). If you want Snap to be installed in a specific directory, you cannot use the method of creating soft links (ln-s) to associate to the new installation directory, otherwise the application of Snap will not start normally.

Here are the main ways to change the default installation directory ~

Main steps

(1) check the mount of snap

Df-h | grep snapd/dev/loop2 92m 92m 0100% / var/lib/snapd/snap/core/8592/dev/loop0 92m 92m 0100% / var/lib/snapd/snap/core/8689

(2) check the running status of snapd service

Systemctl status snapd

(3) stop snapd service

Systemctl stop snapd

(4) Uninstall snapd's / dev/loopxx device

Umount / dev/loop2umount / dev/loop0

(5) create a new data directory for snap

Mkdir / root/snap/snapd

(6) copy data

Rsync-avzP / var/lib/snapd/ / root/snap/snapd/

(7) backup of other data

Cp / etc/fstab / etc/fstab.bakmv / var/lib/snapd / var/lib/snapd.bak

(8) write snap mount information into / etc/fstab file

Echo "/ root/snap/snapd / var/lib/snapd none bind 0" | tee-a / etc/fstab

(9) remount the snap in fstab or restart the machine

Mkdir / var/lib/snapdmount-a

(10) check whether the snapd service has been mounted and started successfully

Ls / var/lib/snapd/ | if grep snaps# exists, the mount is successful. Otherwise, fail ~ systemctl start snapdsnap list

The method of modifying the default installation directory of Snap is shared here. Solving the problem is not just the method analyzed in the article and everyone, but the accuracy of the method analyzed in this article is beyond doubt. If you like this article, you might as well share it for more people to see.

Tags: Catalogs methods services data articles questions success information methods more analysis ease no doubt simplicity company accuracy backup situation copy file Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi OPPO Reno Shulou Information vpn Microsoft