Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What happens when a hard drive gets full with Linux running? Does it lock the system? Or something else, or nothing happens?

I am using Ubuntu Linux.

share|improve this question
2  
Beware that I/O performance will probably degrade quickly as you fill the drive beyond 75%. So the point where you need a new/bigger drive (or to do some cleaning or archiving) is not when it is 95 or 99% full. –  goldilocks Feb 1 '13 at 22:31
    
Thank you very much for those details. I was wandering because on one of my Linux servers I will have a partition with where all my users files will be uploaded to... To be then sent to another "storing" server, that has allot more disk space. I am going to use a software to check the disk space... So you recommend that I should start limiting my users to upload files when the disk is full at 75%? –  jnbdz Feb 1 '13 at 22:49
    
Mostly stuff starts failing misteriously: Can't log into graphics, can't read mail, starting random programs complain/do nonsense, ... –  vonbrand Feb 1 '13 at 22:50
    
@goldilocks - Why does performance degrade? Are you talking about fragmentation issues? –  ire_and_curses Feb 1 '13 at 22:57
1  
@ire_and_curses: Yes; maybe 75% is a bit of a low figure, it depends what the filesystem is used for. Different filesystems types deal with fragmentation in different ways, but none of them can escape the logic that the closer you get to 100%, short of creating some kind of idealized layout and freezing it RO, you have a jigsaw puzzle and you must make smaller pieces of the puzzle to optimize for space, which there must be a trade-off: optimize for space vs. optimize for speed. A fast fs wouldn't fragment at all, but then you could not use all the space. –  goldilocks Feb 2 '13 at 12:38
show 1 more comment

2 Answers

up vote 3 down vote accepted

It should not hang the system; however, applications will fail when they try to write to files and log files might not get updated.

In ext[234] filesystems, an amount of disk is reserved to the root user; this might suit your use case (you don't want your system to have a messy failure by being unable to write a log file).

share|improve this answer
    
Is there a way to catch these errors with a shell script? –  jnbdz Feb 1 '13 at 22:20
    
@Jean-NicolasBoulayDesjardins not that I can think of, but you could write a script that detects when your hard disk space is going low and takes adequate measures to fix the problem. –  Renan Feb 2 '13 at 0:26
    
I though about it. I think I am going to use a monitoring software that will ping every 10 seconds. To check if the disk is full. –  jnbdz Feb 2 '13 at 0:35
2  
Don't check every 10 seconds! That's a waste of resources. And what will you do if your disk is already full? Set a threshold that gives you at least a day or two to solve the problem, and check once a day or so. –  alexis Feb 2 '13 at 12:43
add comment

In ext2/ext3/ext4 file systems 5% of disk space is reserved for root in case of disk being full so processes can work properly. You can check this with command:

$ sudo dumpe2fs /dev/sda1 | grep Reserved

Where /dev/sda1 is device of filesystem (you can check it with df command).

You can alter this value with tune2fs command:

$ sudo tune2fs -r 109117 /dev/sda1
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.