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
for example
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 …
Don’t do that. Make sure you have enough space on your system drive instead. 30GB should be plenty. Do you have a separate Home partition?
Please post the output of:
df -h
Yes as many packages have files in that directory and will overwrite the symlink. Each time a package updates, it will install the files belonging to it.
You’ll see there are many packages that have documentation files in that directory:
I have a separate /home
My / is 39GB, but mostly sits above 95% usage.
I keep it pretty clean - I guess I have a lot of software installed
Structure of my root partition as shown by duc
duc ls /
21.5G home
14.3G usr
990.5M var
961.0M opt
56.8M boot
39.6M etc
9.0M tmp
1.4M run
16.0K exif-info.db
16.0K srv
4.0K cmdline
4.0K .manjaro-tools
4.0K .thumbnails
So / actually only uses 19.4GB
df shows 39GB used, but 21GB is /home … even though /home is a separate partition
So there should in fact be a lot of space on the root partition?
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…
man mount
man fstab
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 (/).
OK, I’ll think about the idea of mounting another fs - sounds like a good plan.
Thanks for the tutorial links - that first one exactly outlines a possible solution for me
But this discussion again raises an old question for me:
my home partition is 20G and root partition is 19G
why does df show root partition size as 36G? This 36G also includes /home
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 (/)
OK, so i should delete the 2 hidden files in root?
What makes you think those would be the correct numbers?
Keep in mind that du gives you the sizes of files and directories, not of filesystems. df is the command that gives you the sizes and usage of filesystems.
Maybe move them somewhere else. .thumbnails however can be deleted altogether.
Adds to 19.4G - and it doesn’t show the home partition
Whereas df (see post above) shows 36G for root partitiion
I guess if df is showing the size of the fie system, then maybe /home is included in that …
But in terms of physical size on disc, surely / is actually 19.4G and not 39G?
Meaning that / should only be 49.7% used (and not 99% used as shown by df)?
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.
man duc
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…
Even more proof - using du on individual directories in /
the only directories of any real size are /usr, /var, /opt, /root
$ du -sh /usr
15G /usr
$ du -sh /opt
969M /opt
$ sudo du -sh /var
1.3G /var
$ sudo du -sh /root
1.9G /root
Still adds to 19G
The mystery remains (at least in my mind)
Seem to have strayed a bit from the original topic.
Altho not really because if my system is only using 19G the original problem was never there in the first place {:
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?
OK, that makes sense …
I have another (fake) user registered … I noticed that there was only one user name under /home on the debian mount - the other user name was not there
What if I remount sdb3 in the debian system and delete the dir with my username under /home?
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.