df error – ‘df: cannot read table of mounted file systems’

[root@host]# df -h
df: cannot read table of mounted file systems
[root@host]# cat etc/mtab
[root@host]# lvdisplay
Parse error at byte 6 (line 1): unexpected token

This is often related to a disk space issue. A post from insanelabs.com recommended freeing up space and then rebuilding /etc/mtab from /proc/mounts like so:
[root@host]# grep -v rootfs /proc/mounts > /etc/mtab
Seemed to do the trick, df is now returning expected results.

df - techpain.com


Ext2Fsd – Access Linux Partitions from Windows

PenDriveLinux.com has a great article on accessing Ext2 and Ext3 partitions from Windows. There are various other ways to do this, but a really quick, simple way (no messing around with mount commands or fstab!) is to use Ext2Fsd. The PenDriveLinux article has
detailed instructions, including screenshots, but it’s really as simple as:

1) Download Ext2Fsd and install.

2) Run Ext2Fsd, assign a drive letter to your Linux drive and reboot.

This makes me much happier about my dual boot configuration (Vista and Ubuntu 9.04), which was previously a pain to manage files between operating systems.


‘Device is Busy’ error – umount and fuser

A filesystem has to be inactive to be able to unmount it. Make sure you’re not trying to use the umount command on a filesystem you’re sitting in (if pwd = /mnt/USBmedia, then umount /mnt/USBmedia will FAIL and throw the ‘device is busy’ error).

If you’re still having an issue with a filesystem remaining active, try fuser.
This can show you the processes (and associated users) running on a specified filesystem, and help you kill those processes.

-m: name specifies a file on a mounted file system or a block device that is mounted. All processes accessing files on that file system are listed. If a directory file is specified, it is automatically changed to name. to use any file system that might be mounted on that directory.

-k: Kill processes accessing the file. Unless changed with -signal, SIGKILL is sent. An fuser process never kills itself, but may kill other fuser processes. The effective user ID of the process executing fuser is set to its real user ID before attempting to kill.

fuser -km /home kills all processes accessing the file system /home in any way.



nfs problems on CentOS5

Had a hard time getting nfs working between two CentOS 5 boxes, kept seeing the client hang when attempting to mount the share. Disabled SELinux, and then ran into a mount.nfs: Stale NFS file handle error. Had to force a umount (umount -f /mnt/share).

Next issue was a time out similar to this:
mount.nfs: mount to NFS server ‘’ failed: timed out, retrying
mount.nfs: mount to NFS server ‘’ failed: timed out, retrying
mount.nfs: mount to NFS server ‘’ failed: timed out, retrying
mount.nfs: mount to NFS server ‘’ failed: timed out, give up.

Stopped iptables and the NFS share started working great. Ok. My iptables is almost identical to another CentOS box that has NFS working fine. Weird. Turns out that NFS ports change, and have to be set statically in /etc/sysconfig/nfs to allow through iptables. I uncommented the following lines:


And set the desired ports, then added those ports to iptables. Then:

service nfs restart
service iptables restart

And mounts with no problem.