PDA

View Full Version : Freespace not increasing????



chn68b
2010-01-19, 10:08
Hi

I'm using Ubuntu 8.10 and I'm trying to copy some music onto an external drive but its unable to do so as there's not enough space....well it was on 2.7Gb of freespace so I've just deleted a load of old stuff (some 7Gb) and the bloody thing is still telling me there's only 2.7Gb free!

I've unmounted it and remounted, rebooted, cleared the trash.

Any idea whats going on?

sebp
2010-01-19, 10:26
Free space not increasing on a filesystem although you delete some files is what happens when some program still has these files open.
Before deleting files, you can check whether some program has them open by using the fuser command (or lsof if you want to see all open files).

snarlydwarf
2010-01-19, 11:01
Free space not increasing on a filesystem although you delete some files is what happens when some program still has these files open.
Before deleting files, you can check whether some program has them open by using the fuser command (or lsof if you want to see all open files).

Don't think that's the issue if he's managed to unmount (which won't work if files are open, even deleted files with hanging file handles).

'du' is your friend.

It will show you how much disk space is used and, more importantly, in which directories. There is a caveat though, so keep reading...

'du /mnt' will show you all the subdirectories of '/mnt' and the size of their contents. Of course, you don't really care about the little ones in a case like this, you want to find the big ones!

'du /mnt | sort -n' will take the output of du and run it through 'sort' and sort numerically. Big things will be at the end.

If you don't want to watch it scroll, you can add 'tail' to the end:
du /mnt | sort -n | tail -20

Will get how much space is in each directory, sort it, and show the 20 largest.

Now the caveat: du and df compute things a bit differently. Unix has a nifty feature called 'hard links' which is basically that two entries in the file system can point to the same spot on the disk. This may sound odd, but it is very useful in many contexts.

'df' which shows free space, doesn't follow the directories, it just looks at a list of unused blocks and figures it out from there.

'du', on the other hand, follows the directories, and ignores what the used count on the drive says. So hard linked files get counted multiple times, even though each one uses the same physical space on the drive. So you may delete something that is a hard link, and it will not really free any space because somewhere else on the file system is a pointer to that space, so it's not reusable.

I don't think that's your case... most users have no clue about hard links and how/why to use them. But I'm being pedantic.

epoch1970
2010-01-19, 12:35
Maybe there is a trash that you can empty ?
EDIT: ok, forget the trash. Sorry.

Or maybe you can mount to a dir on an other partition. I've seen linux miss the mounted drive free space to the one of the underlying partition it is mounted on.

chn68b
2010-01-21, 07:10
sorry guys, looks like this was very simple after all. there was a .trash file hidden away in the root of the usb drive which contained all the deleted files...doh

thanks for the replies, always appreciated, apologies for being a muppet!