Software Woes

Rants, tips and tricks



Wednesday, July 26, 2006



Watch your root partition




Q: What's the worst thing that could happen to you on Linux?
A: I don't know, but not having any more disk space on root partition is disasterous.

It happened to me once again. This time, it looks like I only lost my /etc/hosts file. I was just about to edit it, and tried first with vi. First I mistyped the filename:

milanb@asus:~/devel/svn/ibpp-current$ su
root@asus:/home/milanb/devel/svn/ibpp-current# vi /etc/host
blkwrite failed

Still, not thinking about this strange error message, I tried again:

root@asus:/home/milanb/devel/svn/ibpp-current# vi /etc/hosts
skipping 1 old session file
blkopen's read failed

Ok, I tought to myself, something's the matter with vi. Lets use the second option, mcedit (part of Midnight Commander). What a horrible mistake that was:

root@asus:/etc# mcedit hosts

It opened the file properly. I made the changes and pressed F2 to save. It reported some error that it cannot save it. Ok, nevermind, I exited the editor and to my big surprise: file is truncated!

root@asus:/etc# ls -l hosts
-rw-r--r-- 1 root root 0 2006-07-26 22:34 hosts
root@asus:/etc# cat hosts
root@asus:/etc#

Aaaargh. Now I have to try to remember what was there (I don't backup each and every file on each and every machine I have).

P.S. The screenshot: before posting to blogger I usually write the text in editor, especially when system seems unstable (I was still unaware that the root partition is full). KWrite was nice to let me know what is happening. I guess sometimes I'm too lazy to think, and the good thing is that there are programs like KWrite that think for us :)

2 Comments:

At 9:43 AM, Blogger ipozgaj said...

You can simulate how the specific program will behave while working on full partition by saving file to /dev/full pseudo device. For example:

praetor:~% dd if=/dev/zero of=foo count=1k
1024+0 records in
1024+0 records out
524288 bytes (524 kB) copied, 0.128246 seconds, 4.1 MB/s
praetor:~% cp foo /dev/full
cp: writing `/dev/full': No space left on device

However, if you try to copy an empty file, nothing will happen.

 
At 8:28 PM, Blogger Milan Babuskov said...

Interesting.

Thanks for the tip. I guess I'll now go and try some of apps I frequently use to see what happens.

 

Post a Comment

Links to this post:

Create a Link

<< Home