Tuesday, December 29, 2009

Full Disk in Ubuntu 9.04

I was using Ubuntu 9.04 (Jaunty Jackalope). I started getting error messages indicating that my Linux program partition (mounted as / ) was full. For example: "Error while copying to 'tmp'. There is not enough space on the destination." This surprised me, because when I went to Gparted (Ubuntu > System > Administration > Partition Editor, installed via System > Administration > Synaptic Package Manager), I saw that the Linux root partition was 107GB, of which 102GB was used and only 5GB free.

Andre Mangan advised typing "sudo find / -type f -size +100000k" in Terminal to see what large files I had (with the option of changing the 100000 value). I added a zero, so I was looking for files of roughly 1GB and larger in size. This searched everywhere, including on my mounted data partitions (in /media and/or /mnt), so probably I should have unmounted those before searching: it included .avi (video) and other large but known files. It didn't seem to turn up any unexpected large files, though.

I posted a question on this. Meanwhile, I was noticing all kinds of errors resulting from this problem. Once I closed Gparted, I was not able to start it again: I got an error message, "Failed to run /usr/sbin/gparted as user root. Unable to copy the user's Xauthorization file." I got the same message when attempting to run Synaptic and other programs. I suspected this was also the culprit behind the recent failure of certain rsync (backup) jobs. Whatever was filling space on my drive was still operating; I had had 5MB free just a half-hour earlier.

Drs305's response to my post pointed me to his tutorial on disk space problems. Following the relevant portions of that tutorial, I first unmounted all partitions other than the active root ( / ) partition by typing "sudo umount -a". Then I typed "sudo find / -name '*' -size +1G" and saw that the /media/OFFSITE folder, which was supposed to be a reference to my external OFFSITE hard drive, was instead referring to a folder on the root partition. No wonder I had been having problems with my external backup! I deleted /media/OFFSITE and then typed this:

sudo find / -type d -name '*Trash*' | sudo xargs du -h | sort

This seemed to show me that there were lots of files in the /root trash folder(s), which I probably had never emptied. They appeared to be in /root/.local/share/Trash/files, and maybe elsewhere. To delete root trash, I typed "gksudo nautilus" and, in Nautilus (i.e., File Browser), I made sure to check View > Show Hidden Files. Then, in that session of Nautilus, I navigated to File System /root/.local/share/Trash. I selected the Trash folder and hit Shift-Delete. This said, "Are you sure you want to permanently delete 'Trash'?" I said Delete! with joy. It notified me that it was deleting about 37,000 files. So, duh, this could have been part of the problem. Then I noticed that the faster way to check disk space was, instead of using GParted, to type "df -Th | grep -v "fs".When it was done, I refreshed GParted. Now it showed only 37GB used. Still a lot!  So I thought I should probably pursue some of the other options described in the tutorial.

Before I could do that, though, I ran into a separate problem: my programs drive completely wiped itself out, so I had to restore Ubuntu from a backup.