My root filesystem became 97% full within 3 months and I had to migrate my /home to separate partition
2020-04-13 4 min read
Never did I ever think I would spill a glass of water on my precious MacBook Pro. But I did, on one of the worst day of the year for me to do so; 24th December. On 25th most stores would be closed, 26th was a boxing day and most repairers would be still closed and I had something due on the 27th.
I had no choice but to go in BestBuy filled with festive muggles and make a quick decision on a new laptop because Hossein, macbook repairer I trusted did say "Next time this breaks that'll be the time you need a new machine, man." Everyone else seemed so happy and excited because they were probably there to get christmas presents, whereas I was feeling so dead inside, probably looking dead outside as well.
Anyway, that's how I unexpectedly ended up getting myself a pricey christmas present, ASUS VivoBook, and this was the beginning of my operating system learning journey - specifically with Pop!OS. Only after 3 months my /root became 97% full, which is too quick, and here is how I resolved the issue.
Contents
- My laptop spec
- How I identified the cause of the issue
- How I re-mounted /home
- Overheat issue
- Thoguhts
(1) My laptop spec
My laptop has hybrid memory system where it has 32GB SSD and 512GB PCIe SSD. So in total I had roughly 540GB memory space, which was obviously more than enough. If I'd had a ton of pictures or downloaded movies, I would've only moved those to external HDD but all I had on this machine were local directory for my JavaScript projects. And yet, my root directory said it's full already only after 3 months. My OS is Pop!OS, only because my leptop somehow kept rejecting everything else I tired to install - Ubuntu, Linux Mint, Debian, Manjaro,CentOS. (I still haven't figured out why, it's a mystery till this day.)
(2) How I identified the cause of the issue
On Ask!Ubuntu, someone suggested this command sudo du -hx / | sort -h
that shows major files, its size, and its location to see what exactly was consuming the partition mounted on /
du
= disk usage. Estimates file usage space
-h
= show output in human readable style
|
= pipe. Used to pipe one command to another
After running that command, it was clear that out of top 50 biggest files most of them were located in /home
.
Then I ran another command df -Th
for the first time, and I finally realized I my /home
was mounted on the same partition as /
.
df
= disk free. Displays information related to file systems about total space and available space.
-T
= type
-h
= again, human readable
Just as an example, this is what output looks like if you don't have -h
option
Now that I know what's filling my /, I gotta move that elsewhere.
(3) How I re-mounted /home
I followed this instruction on Ubuntu documentation while referencing this a bit as well.
Following these steps wasn't difficult but just thrilling and scary.
I personally thought the most imporatant part that could save you if anything goes wrong was to make sure to make a copy of fstab. As long as you have a copy of prevoious fstab, you can recreate fstab and re-do the whole process again, which is actually what I did when something went wrong after re-boot.
From command line I recovered the previous fstab and went back into my old /home
and did the whole process again.
(4) Overheat issue
Around the time when my Pop!Os started telling me that I was running out of memory space in the root filesystem, I noticed my machine would get heated excessively. Since both issues emerged almost same time, I just assumed the overheating was caused by pushed memory. Sadly, the heat issue persisted even after I cleared out my root so I had to figure that out as well.
Apparently something was using my CPUs so much but in a weird inconsistent way
First I thought my machine is infected with virus so I scanned using multiple virus scanner but nothing major was detected. Then I came across this CLI application called htop with which I finally got to see what exactly was using up my CPUs; it was packagekitd
.
So I looked up and found this issue. Finally! packagekitd
was indeed what was causing the overheating. In fact, the moment I uninstalled it, it stopped heating at all.
(5) Thoughts
Although it took me 2 days to figure all this out before I actually made up my mind and move /home
to another partition which put me behind my shcedule, I am happy that I got to learn all these new commands, Linux file systems and memory allocation system. This is something I probably wouldn't have to deal with if I was still a mac user, but this is what I wanted when decided to not buy another MacBook and experiment with Linux distros. I know my learning style is through actual trouble shooting than just reading documentations so this was a great excercise.
My mentor Ivan would often say "You can be a okay developer without knowing well about operating systems and computers, but if you want to be a really good one, you gotta know what's going on under the hood".
Typos/comments/suggestions are welcomed on GitHub issues