Background: I'm running Kubuntu 22.04.3 LTS (HWE path, current kernel 6.2.0-34-generic), installed on a 256 GB SSD with additional storage (a LOT of it) on a 1 TB platter drive (legacy from Windows XP) and 1 TB SSD (/home is ~500 GB on the large SSD, / is 50 GB on the smaller, and other partitions take up the rest of the smaller SSD)
Today I tried to run 'sudo flatpak update' because one of my flatpak applications wouldn't start (I suspected this because it's one I don't use often, and sure enough, it was badly outdated). The update went without a hitch, except that one of the flatpak apps failed to update because there was no more room in my / folder. Like 0 bytes free, was the report.
Okay, emptied my trash (at least a few discarded system files that I presumed were still present on / after deletion), then ran 'sudo apt autoremove' which cleared 6.6 GB of space and allowed me to finish the flatpak update. But then on checking why my 50 GB / partition was full (a couple LTS versions ago, I routinely installed Kubuntu in 20 GB partitions), I found the /snap folder was 19.6 GB in size, prompting an immediate question of why this folder is in the OS partition instead of somewhere else (and yes, it's probably possible to give it its own partition during installation, if you know you need to).
The second question arose when I tried to move /snap into /home (which has over 400 GB free; it's on a newish 1 TB SSD): using 'sudo mv snap /home/snap' took a long time (as might be expected, moving between physical devices is a copy/delete operation rather than a rename), then generated a LONG scroll of "mv: cannot remove file <filename>" messages ending with "read-only file system" and left me with a copy of /snap in /home. I then tried 'sudo rm -r -I /snap" and got a matching list of error messages (my intent was to create a link to the copy in /home to replace the original /snap so snap apps will still function but without taking up more than 1/3 of my OS partition). I was able to use mv to rename the folder (to snap.old), and planned to use link to create a link to /home/snap, but got "invalid cross-device link" and I can't make the link in the GUI because of "unfixable security problems in Dolphin" that prevent using Dolphin for privileged operations.
At present, I can undo the renaming of /snap so my snap apps will still work, but want/need to remove the /snap folder from / and replace it with a link to /home/snap in order to continue using my system until at least next summer when 24.04 is ready for upgrades. Ideally, I'd like to similarly get flatpak apps off / (I thought they were in ~ in a hidden folder?).
I'm not a Kubuntu guru; I've been using Debian-based Linux for about twelve years, but I use the GUI when I can, command line when I must, and I get under the hood as little as possible (this is a tool for me, not a hobby).
So, question here is: how can I replace /snap with a link to its copy in /home/snap and free the space in my / partition?
Edit: I was able to create the link to /home/snap with 'ln -s /snap/home /snap' -- so now I just need to remove /snap.old. Permissions show "rwx" for owner in 'ls -l' so I would expect use of sudo with 'rm -r' ought to work, but it doesn't; see above.
Today I tried to run 'sudo flatpak update' because one of my flatpak applications wouldn't start (I suspected this because it's one I don't use often, and sure enough, it was badly outdated). The update went without a hitch, except that one of the flatpak apps failed to update because there was no more room in my / folder. Like 0 bytes free, was the report.
Okay, emptied my trash (at least a few discarded system files that I presumed were still present on / after deletion), then ran 'sudo apt autoremove' which cleared 6.6 GB of space and allowed me to finish the flatpak update. But then on checking why my 50 GB / partition was full (a couple LTS versions ago, I routinely installed Kubuntu in 20 GB partitions), I found the /snap folder was 19.6 GB in size, prompting an immediate question of why this folder is in the OS partition instead of somewhere else (and yes, it's probably possible to give it its own partition during installation, if you know you need to).
The second question arose when I tried to move /snap into /home (which has over 400 GB free; it's on a newish 1 TB SSD): using 'sudo mv snap /home/snap' took a long time (as might be expected, moving between physical devices is a copy/delete operation rather than a rename), then generated a LONG scroll of "mv: cannot remove file <filename>" messages ending with "read-only file system" and left me with a copy of /snap in /home. I then tried 'sudo rm -r -I /snap" and got a matching list of error messages (my intent was to create a link to the copy in /home to replace the original /snap so snap apps will still function but without taking up more than 1/3 of my OS partition). I was able to use mv to rename the folder (to snap.old), and planned to use link to create a link to /home/snap, but got "invalid cross-device link" and I can't make the link in the GUI because of "unfixable security problems in Dolphin" that prevent using Dolphin for privileged operations.
At present, I can undo the renaming of /snap so my snap apps will still work, but want/need to remove the /snap folder from / and replace it with a link to /home/snap in order to continue using my system until at least next summer when 24.04 is ready for upgrades. Ideally, I'd like to similarly get flatpak apps off / (I thought they were in ~ in a hidden folder?).
I'm not a Kubuntu guru; I've been using Debian-based Linux for about twelve years, but I use the GUI when I can, command line when I must, and I get under the hood as little as possible (this is a tool for me, not a hobby).
So, question here is: how can I replace /snap with a link to its copy in /home/snap and free the space in my / partition?
Edit: I was able to create the link to /home/snap with 'ln -s /snap/home /snap' -- so now I just need to remove /snap.old. Permissions show "rwx" for owner in 'ls -l' so I would expect use of sudo with 'rm -r' ought to work, but it doesn't; see above.
Comment