Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Fedora 18, Slackware64 13.37, Windows 7/8
Posts: 386
Rep:
151GB of free space has gone missing
I'm really struggling to understand what's happening here. My server is Ubuntu 14.04.02 LTS and I've seemed to have misplaced 151GB of file space. The server started reporting this morning that it was out of free space, but as far as I can tell, I'm only using 76GB.
This df is shady because it says there is 212G used (of 226G), which is not 2.8G (is 226-212 somehow not 14G?)
Then I listed the disk usage for every directory off / and it shows I'm only using 76GB (approx.)
Code:
developer@BAILEYFS01:~$ ls /
bin etc lib mnt run tmp vmlinuz.old
boot home lib64 opt sbin usr webmin-setup.out
data initrd.img lost+found proc srv var
dev initrd.img.old media root sys vmlinuz
I've omitted the /media path since those are remote samba & USB mounts to separate volumes
Distribution: Fedora 18, Slackware64 13.37, Windows 7/8
Posts: 386
Original Poster
Rep:
Quote:
Originally Posted by Keruskerfuerst
I also had this problem with hidden file.
Solution: reinstallation.
Please don't say that. This server is the engine that drives a small network and I don't even want to think about what a rebuild would entail at this point.
You may have a sparse file or two taking up space that is not reported by du by default, but is reported by df, ls and other stat checks.
You can use the --apparent-size option to du to find where those are. They are often associated with virtualization, among other things, so that might be a first place to look.
In the df output, the reserved space (by default, 5%) is not included in either the "Used" or "Avail" columns. That accounts for your missing 11.3G.
There are two possibilities for the extra used space (and "sparse file" is not one of them):
There are one or more large files that have been deleted, and thus invisible to du, but are still held open by some program.
You have files hidden under an active mount point.
You can look for unlinked files by running
Code:
lsof | grep -i del | less
and scroll through the output looking for huge files. Yes, there will be a lot of cruft to ignore in that list.
You can look for files hidden under an active mount point this way:
Code:
mkdir /tmp/tmproot
mount --bind / /tmp/tmproot
du --max-depth=1 /tmp/tmproot
You can of course dig deeper by adjusting the path and/or the max-depth setting. If you find files there that should not exist, you can simply rm them, or move them elsewhere.
The output of the df command does not show reserved space which is why the numbers do not add up.
In addition to a sparse file, if for some reason one of the USB drives were not mounted and a scheduled backup wrote to / instead of sdd1 or sde2 then once the drive(s) were remounted the used space would appear to be missing. If you deleted large files but the running process still held them opened then used space would appear to be missing.
I had one that ran three years, no problem. Then it reported no free space. I rebooted, space was back. Looked for trash file build up, logs, etc. Could not find anything.
I wrote a script and put it in crontab that sends me a df report each day. When the used space gets to over 90 I login and reboot it, then we start at around 22% used again. It gains 1-3% per day. The site has one web site on it and nothing else.
Here's the script:
df -h | grep /dev/ | mailx -s "%free - When the % hits 90, we worry." myemail@myaddress.com
I spent hours looking for it. Saved the output of du then ran it again a couple days later and compared the files sizes, found nothing substantial.
This doesn't fix it, but maybe the script will help you prevent a problem.
Distribution: Fedora 18, Slackware64 13.37, Windows 7/8
Posts: 386
Original Poster
Rep:
Quote:
Originally Posted by michaelk
if for some reason one of the USB drives were not mounted and a scheduled backup wrote to / instead of sdd1 or sde2 then once the drive(s) were remounted the used space would appear to be missing. If you deleted large files but the running process still held them opened then used space would appear to be missing.
There are nightly backups scheduled to both those USB drives and I did indeed determine that /media/seagate3 (an ntfs-3g volume) somehow lost its mount. The backup script uses rsync which I assume will not arbitrarily write to /? Who knows, that would explain how a full 3rd of the hard drive mysteriously filled up overnight.
I rebooted the server a few times and the space didn't reappear. I guess I'll try the stuff @rknichols recommended.
The only way to reclaim the space is to delete the files on the / file system. Rsync can not tell if a directory is a mount point. You might want to add a check to your backup script to check if the drive is still mounted.
Distribution: Fedora 18, Slackware64 13.37, Windows 7/8
Posts: 386
Original Poster
Rep:
Quote:
Originally Posted by rknichols
You can look for files hidden under an active mount point this way:
Code:
mkdir /tmp/tmproot
mount --bind / /tmp/tmproot
du --max-depth=1 /tmp/tmproot
You can of course dig deeper by adjusting the path and/or the max-depth setting. If you find files there that should not exist, you can simply rm them, or move them elsewhere.
From this output I'm noticing the /tmp/tmproot/media folder is using 123G. All the directories in /media are mount points to other volumes (USB and Samba).
I guess I'm asking, how do I ascertain what, if anything is safe to delete from this remounted /tmp/tmproot path?
Thanks again for all the help. There's zero chance I'd have figured this one out on my own.
--UPDATE--
It think that was it. Looks like when the destination USB drive is not mounted any more it sends the backups into some dangling hidden path...
Here's the df output after blowing out that /tmp/tmproot/media/seagate3 path
--UPDATE--
It think that was it. Looks like when the destination USB drive is not mounted any more it sends the backups into some dangling hidden path...
That's the sort of thing I expected to see. At some point you performed the backup, and since the mount point directory "/media/seagate3" existed, that's where the backup was sent. But, without the external drive mounted there, that directory was just part of the root filesystem. When the external drive is mounted there, you can't see those root filesystem files without doing the bind-mount that I suggested.
FWIW, the way I protect myself against this sort of mishap is by making a subdirectory, like "backups", on my backup drive and storing my backups there. If I try to run backups without the drive mounted, backup fails because directory "/media/seagate3/backups/" doesn't exist.
Distribution: Fedora 18, Slackware64 13.37, Windows 7/8
Posts: 386
Original Poster
Rep:
Quote:
Originally Posted by rknichols
FWIW, the way I protect myself against this sort of mishap is by making a subdirectory, like "backups", on my backup drive and storing my backups there. If I try to run backups without the drive mounted, backup fails because directory "/media/seagate3/backups/" doesn't exist.
Excellent suggestion indeed. As soon as I get a few minutes of spare time I'm going to add some logic like:
Code:
if [ ! -d "/media/seagate3/Backup" ]; then
...
fi
into the nightly, monthly, and annually backup scripts.
Again, I can't express my gratitude enough for your help on this!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.