LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-07-2015, 11:45 AM   #1
thund3rstruck
Member
 
Registered: Nov 2005
Location: East Coast, USA
Distribution: Fedora 18, Slackware64 13.37, Windows 7/8
Posts: 386

Rep: Reputation: 43
Question 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?)

Code:
developer@BAILEYFS01:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       226G  212G  2.8G  99% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            1.7G   12K  1.7G   1% /dev
tmpfs           345M  7.3M  338M   3% /run
none            5.0M     0  5.0M   0% /run/lock
none            1.7G     0  1.7G   0% /run/shm
none            100M     0  100M   0% /run/user
/dev/md0        7.3T  4.6T  2.3T  67% /media/share/raid0
/dev/sdd1       2.7T  1.9T  780G  72% /media/share/backup1
/dev/sde1       2.8T  2.5T  299G  90% /media/seagate3
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

Code:
developer@BAILEYFS01:~$ sudo du -ckh /bin | tail -n 1 | cut -f1
9.7M
developer@BAILEYFS01:~$ sudo du -ckh /boot | tail -n 1 | cut -f1
59M
developer@BAILEYFS01:~$ sudo du -ckh /data | tail -n 1 | cut -f1                
0
developer@BAILEYFS01:~$ sudo du -ckh /dev | tail -n 1 | cut -f1
12K
developer@BAILEYFS01:~$ sudo du -ckh /etc | tail -n 1 | cut -f1
61M
developer@BAILEYFS01:~$ sudo du -ckh /home | tail -n 1 | cut -f1
69G
developer@BAILEYFS01:~$ sudo du -ckh /lib | tail -n 1 | cut -f1
439M
developer@BAILEYFS01:~$ sudo du -ckh /lib64 | tail -n 1 | cut -f1
4.0K
developer@BAILEYFS01:~$ sudo du -ckh /lost+found/ | tail -n 1 | cut -f1
16K
developer@BAILEYFS01:~$ sudo du -ckh /mnt | tail -n 1 | cut -f1
4.0K
developer@BAILEYFS01:~$ sudo du -ckh /opt/ | tail -n 1 | cut -f1
84M
developer@BAILEYFS01:~$ sudo du -ckh /root | tail -n 1 | cut -f1
124K
developer@BAILEYFS01:~$ sudo du -ckh /run | tail -n 1 | cut -f1
7.2M
developer@BAILEYFS01:~$ sudo du -ckh /sbin | tail -n 1 | cut -f1
12M
developer@BAILEYFS01:~$ sudo du -ckh /srv | tail -n 1 | cut -f1
4.0K
developer@BAILEYFS01:~$ sudo du -ckh /sys | tail -n 1 | cut -f1
0
developer@BAILEYFS01:~$ sudo du -ckh /tmp | tail -n 1 | cut -f1
65M
developer@BAILEYFS01:~$ sudo du -ckh /usr | tail -n 1 | cut -f1
1.9G
developer@BAILEYFS01:~$ sudo du -ckh /var | tail -n 1 | cut -f1
3.5G
developer@BAILEYFS01:~$ sudo du -ckh /vmlinuz | tail -n 1 | cut -f1
0
I've got virtualbox vms and scripts that are now failing since the system thinks its out of free space on the root partition /dev/sda1.

What do I need to do to recover this 151GB of space that has somehow vanished into thin air...

Please help....

 
Old 07-07-2015, 11:52 AM   #2
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199

Rep: Reputation: 164Reputation: 164
I also had this problem with hidden file.
Solution: reinstallation.
 
Old 07-07-2015, 12:08 PM   #3
thund3rstruck
Member
 
Registered: Nov 2005
Location: East Coast, USA
Distribution: Fedora 18, Slackware64 13.37, Windows 7/8
Posts: 386

Original Poster
Rep: Reputation: 43
Quote:
Originally Posted by Keruskerfuerst View Post
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.
 
Old 07-07-2015, 12:53 PM   #4
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199

Rep: Reputation: 164Reputation: 164
I had the same problem with
1. Windows 7
2. Gentoo Linux
 
Old 07-07-2015, 01:03 PM   #5
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196
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.

... or see the next post by rknichols...

Last edited by astrogeek; 07-07-2015 at 01:29 PM.
 
Old 07-07-2015, 01:21 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,783

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
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):
  1. There are one or more large files that have been deleted, and thus invisible to du, but are still held open by some program.
  2. 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.

After you are done:
Code:
umount /tmp/tmproot
rmdir /tmp/tmproot
All of the above needs to be done as root.
 
2 members found this post helpful.
Old 07-07-2015, 01:35 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,750

Rep: Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929
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.

rknichols was faster...

Last edited by michaelk; 07-07-2015 at 01:36 PM.
 
1 members found this post helpful.
Old 07-07-2015, 01:36 PM   #8
lrzak
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Rep: Reputation: 1
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.

leon ...

Last edited by lrzak; 07-07-2015 at 01:38 PM.
 
1 members found this post helpful.
Old 07-07-2015, 05:52 PM   #9
thund3rstruck
Member
 
Registered: Nov 2005
Location: East Coast, USA
Distribution: Fedora 18, Slackware64 13.37, Windows 7/8
Posts: 386

Original Poster
Rep: Reputation: 43
Quote:
Originally Posted by michaelk View Post
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.
 
Old 07-07-2015, 06:22 PM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,750

Rep: Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929
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.
 
1 members found this post helpful.
Old 07-07-2015, 06:44 PM   #11
thund3rstruck
Member
 
Registered: Nov 2005
Location: East Coast, USA
Distribution: Fedora 18, Slackware64 13.37, Windows 7/8
Posts: 386

Original Poster
Rep: Reputation: 43
Quote:
Originally Posted by rknichols View Post
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.

After you are done:
Code:
umount /tmp/tmproot
rmdir /tmp/tmproot
Okay... I'm not 100 sure what I'm looking at.
Code:
developer@BAILEYFS01:~$ sudo du -h --max-depth=1 /tmp/tmproot/
4.0K    /tmp/tmproot/proc
4.0K    /tmp/tmproot/sys
69G     /tmp/tmproot/home
9.7M    /tmp/tmproot/bin
4.0K    /tmp/tmproot/srv
16K     /tmp/tmproot/lost+found
123G    /tmp/tmproot/media
124K    /tmp/tmproot/root
3.5G    /tmp/tmproot/var
59M     /tmp/tmproot/boot
8.0K    /tmp/tmproot/dev
84M     /tmp/tmproot/opt
61M     /tmp/tmproot/etc
1.9G    /tmp/tmproot/usr
439M    /tmp/tmproot/lib
4.0K    /tmp/tmproot/run
4.0K    /tmp/tmproot/mnt
4.0K    /tmp/tmproot/lib64
1.6M    /tmp/tmproot/tmp
12M     /tmp/tmproot/sbin
197G    /tmp/tmproot/
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

Code:
developer@BAILEYFS01:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       226G   75G  140G  35% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            1.7G  4.0K  1.7G   1% /dev
tmpfs           345M  7.1M  338M   3% /run
none            5.0M     0  5.0M   0% /run/lock
none            1.7G     0  1.7G   0% /run/shm
none            100M     0  100M   0% /run/user
/dev/sde1       2.8T  2.5T  314G  89% /media/seagate3
/dev/md0        7.3T  4.6T  2.3T  67% /media/share/raid0
/dev/sdd1       2.7T  1.9T  821G  70% /media/share/backup1

Last edited by thund3rstruck; 07-07-2015 at 07:02 PM. Reason: Update
 
Old 07-07-2015, 07:37 PM   #12
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,783

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Quote:
Originally Posted by thund3rstruck View Post
--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.
 
2 members found this post helpful.
Old 07-08-2015, 07:57 AM   #13
thund3rstruck
Member
 
Registered: Nov 2005
Location: East Coast, USA
Distribution: Fedora 18, Slackware64 13.37, Windows 7/8
Posts: 386

Original Poster
Rep: Reputation: 43
Quote:
Originally Posted by rknichols View Post
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!
 
  


Reply

Tags
df, du, ext4, ubuntu 14.04, ubuntu server



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
No more free space! df 99.9%, du 29% usage - missing free space ? Topper_BG Linux - General 14 02-08-2012 02:40 PM
[SOLVED] /usr missing free space yoachan Linux - Server 4 08-24-2010 05:09 AM
Missing hard drive free space encomium Linux - Server 3 03-26-2008 02:11 AM
Debian and MythTV missing free space chip33az Debian 3 10-01-2004 12:50 PM
Formating free space: WinXP pro and RH9 dualboot with free space on 3rd drive Vermicious Linux - General 2 03-22-2004 05:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration