Sometime I need to resize my Manjaro partition …
Being rightfully nervous about doing this (it’s an old installation, maybe 8 years, and well loved),
I have shifted one or two large system folders to a data drive
pacman cache (updated it’s location in pacman.conf) - saves 9GB
aur build dir (updated it’s location in pamac.conf) - saves 3.5GB
.local/share/baloo (left a sym link in it’s place) - saves 1.5 GB
/usr/share/doc (left a sym link in its place)
A problem with the last one /usr/share/doc …
With each update the sym link is removed and a new doc directory is created
Is this expected behaviour? Any work-around?
/usr/share/doc approaches 1GB on my system, but I use those docs a lot …
Yes, it is. You’re not supposed to replace system directories with symbolic links.
Well, instead of using symbolic links, you could just as easily mount another filesystem to those directories — the filesystem where you moved their contents to. And if they’re both pointing at the same filesystem, then you can use bind-mounts on the directories that contain the actual files.
Of course, you’ll need to make sure that you’ve properly moved everything over before doing that, and it is actually best done from the live USB/DVD/CD session, so that nothing under the /usr hierarchy of your installed system will be in use.
You don’t even need to chroot for that. Just make sure all of the files are properly moved over to where you want them to be, and then set up bind-mounts in /etc/fstab. See…
You may also want to check out these two tutorials below…
It’s not the packages doing that. The packages themselves will be perfectly happy with the designated target being a symbolic link. However, it’s the filesystem package that does this.
filesystem makes sure that all of the required directories of the filesystem tree are created, and that they have the proper permissions. And if a directory has been replaced by a symbolic link, it will replace that symbolic link again by a proper directory.
Show us the output of df. And by the way, you’ve got stuff in your root directory that doesn’t belong there. There should be no hidden files or hidden directories in your root directory (/).
Nope, it isn’t, because df shows you the correct mountpoints and how much space is used on each volume in the list.
I am not familiar with duc, but perhaps it is not including certain directories in its calculation. This is possible if it only descends into subdirectories up to a certain level. When in doubt, read the manual.
Either way, df is showing you the correct values, unless you are using btrfs as your filesystem, in which case you need to use btrfs’s own tools for accurate numbers. See…
Part of your filesystem is also being used by the ext4 journal. I’m not sure of the percentage, but I believe the maximum size for the journal on an ext4 filesystem with 4K block size to be 2 GiB.
Another thing that’s possible — I should have thought about this earlier — could be that you have at one point dumped a whole lot of stuff into /home without that /home was mounted. As a result, all of those files would still be there and consuming space on the root filesystem, but they would be invisible for as long as your /home partition is mounted.
You have to keep in mind that in and of itself, /home is only a directory on the root filesystem, and if nothing is mounted there, then whatever gets written to /home will be taking up space on the root filesystem itself. If you then mount another filesystem on /home later without having cleaned out the directory first, then that content is simply hidden by the new mount, but that doesn’t mean it’s no longer there.
The best way of checking this is to boot up from the live USB — without chrooting! — and mount your root filesystem (/dev/sdb3) to /mntwithout also mounting your /home filesystem (/dev/sdb2), and then checking whether there is anything under /mnt/home. I’m willing to bet that there’s a lot of stuff there.
OK I did as you suggested - I booted up with a debian usb and mounted /dev/sdb3 to /mnt/manjaro and /dev/sdb2 to /mnt/manjaro-home.
When I looked into /mnt/manjaro/home there was a dir with my username, but the dir is empty - no contents.
This separate home partition was set up when I installed manjaro a few years back. It’s unlikely that /home has ever been unmounted
If there is a directory with your username under the unmounted /home, then it must have been used unmounted at some point, because if /home was always a mountpoint, then the /home on the root filesystem would be empty — no directory with your username.
And just because the directory with your username appears empty doesn’t mean that it is. There could be hidden directories and hidden files in there.
And what about swap files? Do you have any of those on your root partition?
What if there is a bunch of files and directories under /mnt because you copied/moved that stuff there without that /dev/sda1 and/or /dev/sda2 were mounted?
So, considering that nothing under /mnt is needed by the system, I would suggest that you temporarily unmount /dev/sda1 and /dev/sda2 and then take a look at what still lives under /mnt/data and /mnt/touro.
Very nice tip, thanks - it’s in my regular toolbox now (:
I mounted sdb3 on a live USB and ran du
It shows a total usage of 19G
As @Aragorn suspected above, the home folder did have some hidden folders dated 2018 which I deleted. Only amounted to 1.5M
But wait, there’s more …
There were indeed a bunch of files inside /mnt/touro and /mnt/data, when I unmounted those partitions … some pacman packages (2.7G) and some old duplicity backup files (15G). I have removed those now. How they got there I can’t say - at some point when duplicity or pacman were writing to disc but those partitions were not mounted - it’s hard to see when a situation like that could have arisen seeing that those are mounted by fstab …
The best way is to ensure that all filesystems are mounted at boot, either by way of /etc/fstab or by way of a systemd mount, instead of relying on automounting on login. It’s really not hard to do, and it can save you a lot of trouble later.