Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] SSD says it is full
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
davidbrooke
Guru
Guru


Joined: 03 Jan 2015
Posts: 341

PostPosted: Sun Jun 21, 2015 7:54 pm    Post subject: [SOLVED] SSD says it is full Reply with quote

I was notified that space was running out on my 240GB SSD. I looked and there was less than a GB of free space. I quickly removed a few files that freed up approximately 15GB. This drive is mainly just the OS and usually ranges in used space from 20-30GB. I ran:
/ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 220G 196G 14G 94% /
devtmpfs 10M 0 10M 0% /dev
tmpfs 785M 612K 785M 1% /run
cgroup_root 10M 0 10M 0% /sys/fs/cgroup
shm 3.9G 30M 3.9G 1% /dev/shm
tmpfs 3.9G 20K 3.9G 1% /tmp

I decided to review what was using the rest of the space. I ran the following from the root directory:
du -Sh | sort -rh | head -n 100
and
find . -type f -exec du -Sh {} + | sort -rh | head -n 100

Using either method, I added up the used space and came up with approximately 23GB verses the 196GB shown to be used. I also checked the smart data which showed no failures or errors and ran fsck -c. So at this point I'm not sure if I have a file or files totaling 173GB that I can't find or there is a hard drive issue.
Any help would be appreciated.
Thanks


Last edited by davidbrooke on Mon Jun 22, 2015 3:49 pm; edited 1 time in total
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6780

PostPosted: Sun Jun 21, 2015 8:08 pm    Post subject: Reply with quote

You did not write which fiesystem you are using: Possible answers depend on this.

For a "classical" filesystem (e.g. ext*) there can be 2 causes for the difference:
1. You have a lot of very small files. For instance, for the gentoo tree the factor 10 between the sum of the data and the disk space actually used can be normal. Similarly, if you have huge html directories. For other data such a factor is strange...
2. Your system has reserved one (or several) huge files for some reason (e.g. on /tmp) but the filehandle is not yet closed. To make sure that the data is freed, you need to umount and mount again. If it is your main disk, you might need to reboot.
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2977
Location: Germany

PostPosted: Sun Jun 21, 2015 8:16 pm    Post subject: Reply with quote

Code:

mkdir /mnt/root
mount --bind / /mnt/root
xdiskusage /mnt/root
Back to top
View user's profile Send private message
davidbrooke
Guru
Guru


Joined: 03 Jan 2015
Posts: 341

PostPosted: Sun Jun 21, 2015 8:21 pm    Post subject: Reply with quote

mv wrote:
You did not write which fiesystem you are using: Possible answers depend on this.

For a "classical" filesystem (e.g. ext*) there can be 2 causes for the difference:
1. You have a lot of very small files. For instance, for the gentoo tree the factor 10 between the sum of the data and the disk space actually used can be normal. Similarly, if you have huge html directories. For other data such a factor is strange...


I'm using ext4 fs and i have similar installations that are not having this problem of consuming the hard drive. I have also used Dolphin to review the space consumed and it is relatively close to the du commands.

Quote:
2. Your system has reserved one (or several) huge files for some reason (e.g. on /tmp) but the filehandle is not yet closed. To make sure that the data is freed, you need to umount and mount again. If it is your main disk, you might need to reboot.


I have rebooted numerous times and used System Rescue to run the du commands.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3943
Location: Hamburg

PostPosted: Sun Jun 21, 2015 8:24 pm    Post subject: Reply with quote

B7c you use a SSD, do you let the OS trim/discard it ? (eg.: I do have :
Code:
/dev/sda3               /               btrfs           noatime,discard,compress=lzo,ssd_spread        0 0
)
Back to top
View user's profile Send private message
davidbrooke
Guru
Guru


Joined: 03 Jan 2015
Posts: 341

PostPosted: Sun Jun 21, 2015 8:29 pm    Post subject: Reply with quote

toralf wrote:
B7c you use a SSD, do you let the OS trim/discard it ? (eg.: I do have :
Code:
/dev/sda3               /               btrfs           noatime,discard,compress=lzo,ssd_spread        0 0
)


My current fstab entry:
/dev/sda1 / ext4 defaults,relatime,discard 0 1
Back to top
View user's profile Send private message
davidbrooke
Guru
Guru


Joined: 03 Jan 2015
Posts: 341

PostPosted: Sun Jun 21, 2015 8:37 pm    Post subject: Reply with quote

frostschutz wrote:
Code:

mkdir /mnt/root
mount --bind / /mnt/root
xdiskusage /mnt/root


Please give some insight as to what you are proposing.
Thanks
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2977
Location: Germany

PostPosted: Sun Jun 21, 2015 8:49 pm    Post subject: Reply with quote

bind mount lets you find files currently hidden under other mountpoints

xdiskusage (if you have X) is easier to interpret than du output
Back to top
View user's profile Send private message
davidbrooke
Guru
Guru


Joined: 03 Jan 2015
Posts: 341

PostPosted: Mon Jun 22, 2015 2:12 pm    Post subject: Reply with quote

frostschutz wrote:
bind mount lets you find files currently hidden under other mountpoints

xdiskusage (if you have X) is easier to interpret than du output


Using your approach I was able to better see what was happening but I still don't understand how it happened.
Maybe someone can give me some insight so that it doesn't occur again. Here are more details of my situation:

1. I was using a nightly cron job to rsync sdc1 to sdd1. Here is the crontab -l:
Code:
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.XXXXhZ3RjR installed on Mon Mar  2 11:51:04 2015)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
0 1 * * * /usr/bin/rsync -av --stats --delete /media/sdc1/ /media/sdd1/


2. I do periodic checks on sdd1 to make sure all is well. I did this and saw that sdd1 hadn't been updated for a couple of weeks. I also saw that smart data said that the drive was failing. I commented out the fstab entry and ordered a new drive.

3. I few hours later I was notified via KDE that sda1 was low on space (< 1GB left). I then researched and worked on a solution but failed and came to Gentoo forums.

4. Using the xdiskusage I was able to see that part of sdd1 was copied onto sda1 causing the low disk space issue. I saw this earlier using the du command but didn't quite understand it do to my lack of linux knowledge.

5. I used System Rescue and mounted sda1 and removed /media/sdd1. Rebooted and saw that sda1 was using 35GB vs the 195GB previously.

If anyone could comment on how my issue happened and how not to let it occur again, it would be appreciated.
Thanks
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2977
Location: Germany

PostPosted: Mon Jun 22, 2015 2:23 pm    Post subject: Reply with quote

You have to check that a mountpoint is actually mounted afore dumping tons of data into it.

Either that or make sure the copy will fail somehow by removing permissions of the unmounted mountpoint.
Back to top
View user's profile Send private message
davidbrooke
Guru
Guru


Joined: 03 Jan 2015
Posts: 341

PostPosted: Mon Jun 22, 2015 3:27 pm    Post subject: Reply with quote

I found this example:
Code:
DIR=/Volumes/External;
if [ -e $DIR ];
then rsync -av ~/dir_to_backup $DIR;
else echo "$DIR does not exist";
fi


I would change it:
Code:
DIR=/media/sdd1;
if [ -e $DIR ];
then rsync -av --stats --delete /media/sdc1/ /media/sdd1/;
else echo "$DIR does not exist";
fi


or use:
Code:
DIR=/media/sdd1;
test -e $DIR && rsync -av --stats --delete /media/sdc1/ /media/sdd1/;


Comments please.
Thanks
Back to top
View user's profile Send private message
davidbrooke
Guru
Guru


Joined: 03 Jan 2015
Posts: 341

PostPosted: Mon Jun 22, 2015 3:49 pm    Post subject: Reply with quote

I think it would be better to start a new topic. I will be moving over to "Other Things Gentoo" to get feedback for using rsync.
Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum