Using e2fsck. File System Check
From OpenFSG
Contents |
Introduction
This example illustrates how to run a file system check on the /dev/hdd4/ partition of the NDP disk. This is the partition that contains all of the user data, ie the /home directory
I would suggest that you do not attempt to do this procedure without first having a good understanding of
a, what your trying to achieve
b, what your doing
Be warned,Do not enter into this procedure lightly.
Do create a backup of your personal files first, before commencing any file system maintenance.
System requirements
NDP Pro Firmware version 4.4.8 or above. e2fsck does not exist on earlier firmwares.
Prerequisites
1. Make sure there are no processes using the /home directory Like Media Server or Ftp Server for example. If they are enabled, Disable them using the services section of the web login.
2. Make sure there are no PC's on the network that have mapped network drives on the NDP. Don't forget, If the pc your working from has a mapped drive on the NDP, You must disable the map first. Switch off any other machines on the network that have mapped network drives on the NDP.
3. If you have any of conditions 1 or 2, Then you must reboot the NDP before proceeding.
Preparing the system for file checking
Basic_system_file_editing, login as admin cd to root, change to su
You must cd to root before changing to su, otherwise admin will still be using /home..... & the umount will not work!
If this happens you will get the following error umount: Couldn't umount /home: Invalid argument
you now need to unmount all mounted folders on the disk you wish to check.
To find out what these folders are you can type the command df (disk free)
in this case, Folders mounted on /dev/hdd4/ are, /home & /opt . You must now unmount them
umount /home
umount /opt
NOTE: the command is umount NOT unmount Example below.
Running e2fsck
Check without changing file system
Now use the command e2fsck -n -f -v /dev/hdd4 (n = nochange v = verbose f = force even if flagged as clean)
To see the full list for e2fsck usage type e2fsck
The important bit here is the -n switch, this will run the e2fsck as a dummy run & not change any system files.
I.e., Using this command will only highlight problems not fix them. Example below.
Check with changing the file system
To fix any errors you have (I guess at this stage, I should point out again the benefit of creating a backup ;)
you can use e2fsck -y -f -v /dev/hdd4 (y = default answer is yes) Only use this command if your entirely happy with answering Yes to every problem displayed from the -n run.
If not omit the -y (e2fsck -f -v /dev/hdd4) and answer y or n manually. Example below.
Finally, Re-run the e2fsck -n -f -v /dev/hdd4 command and check the results. Example below.
Remounting the unmounted file systems
This bits easy, as the mount process is controlled by a script that is run at start-up (/etc/init.d/rcS)
So let the NDP do the work for you here & REBOOT!
Known Limitation / problems
If you still get /dev/hdd4: ********** WARNING: Filesystem still has errors ********** after your final -n run
Check through the list to see what that error/errors were. In the case illustrated it was /lost+found not found. Create? no
I'm currently looking into this issue. The /lost+found folder does exist but e2fsck doesn't seem to recognise it I will update this article as and when a cure has been found.
--alfonz 13:54, 31 July 2008 (CEST)




