Q. My laptop partition /dev/sdb1 is showing file system error, how do i use fsck command to check for file system error and repair the partition.
Solution is to use fsck – check and repair a Linux file system or use e2fsck – check a Linux ext2/ext3 file system.
Device Start End Blocks Id System
/dev/sdb1 1 2861 2011014+ 6 FAT16
Step 1 – Go to single user mode if needed and then Unmount the partition.
root@laptop:# init 1 [for my laptop there was no need to go to single user mode, as i was able to unmount the partition]
root@laptop:# umount /dev/sdb1
Step 2 – Run Fsck on /dev/sdb1
root@laptop:# fsck -yvf /dev/sdb1
fsck 1.41.4 (27-Jan-2009)
dosfsck 3.0.1 (23 Nov 2008)
dosfsck 3.0.1, 23 Nov 2008, FAT32, LFN
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID “MSDOS5.0″
Media byte 0xf8 (hard disk)
512 bytes per logical sector
32768 bytes per cluster
4 reserved sectors
First FAT starts at byte 2048 (sector 4)
2 FATs, 16 bit entries
125952 bytes per FAT (= 246 sectors)
Root directory starts at byte 253952 (sector 496)
512 root directory entries
Data area starts at byte 270336 (sector 528)
62835 data clusters (2058977280 bytes)
63 sectors/track, 255 heads
243 hidden sectors
4022029 sectors total
Reclaiming unconnected clusters.
/dev/sdb1: 1050 files, 53941/62835 clusters
You can also user logsave which saves the output of a command in a logfile.
root@laptop:# logsave -asv /var/log/fsck.log fsck -y /dev/sdb1
Log of fsck -y /dev/sdb1
Tue Nov 24 13:25:06 2009
fsck 1.41.4 (27-Jan-2009)
dosfsck 3.0.1, 23 Nov 2008, FAT32, LFN
/dev/sdb1: 1050 files, 53941/62835 clusters
Tue Nov 24 13:25:07 2009
Remount after running fsck
root@laptop:# mount /dev/sdb1 /media/home2/