Fixing file system from bad shutdown or bad superblock error, and cannot start

Fixing file system from bad shutdown or bad superblock error, and cannot start



Sometimes different reasons or by bad shutdown, the filesystem could be damaged and drops you in a shell of initramfs busybox, a limited safe mode interactive shell, or for some reason the system complains of a bad superblock and drops you in a similar environment, regardless the filesystem is damaged and you cannot boot normally, a good way to fix this is to boot with a linux live system and to fix with fsck:
       
1.) Boot in linuxlive system, make sure that when this is to be done, that the filesystem to fix is not mounted
2.) Check the partitions, find the proper one:
# fdisk -l |grep Linux|grep -Ev 'swap'
3.) For this example the partition to be fixed is sda3:
# dumpe2fs /dev/sda3 | grep superblock  

/or


# mke2fs -n /dev/sda3



4.) You should get a similar output as:

Primary superblock at 0, Group descriptors at 1-6
  Backup superblock at 32768, Group descriptors at 32769-32774
  Backup superblock at 98304, Group descriptors at 98305-98310
  Backup superblock at 163840, Group descriptors at 163841-163846
  Backup superblock at 229376, Group descriptors at 229377-229382
  Backup superblock at 294912, Group descriptors at 294913-294918
  Backup superblock at 819200, Group descriptors at 819201-819206
  Backup superblock at 884736, Group descriptors at 884737-884742
  Backup superblock at 1605632, Group descriptors at 1605633-1605638
  Backup superblock at 2654208, Group descriptors at 2654209-2654214
  Backup superblock at 4096000, Group descriptors at 4096001-4096006
  Backup superblock at 7962624, Group descriptors at 7962625-7962630
  Backup superblock at 11239424, Group descriptors at 11239425-11239430
  Backup superblock at 20480000, Group descriptors at 20480001-20480006
  Backup superblock at 23887872, Group descriptors at 23887873-23887878

- now choose a Sblock such as the first one is likely the one to fix issue:
# fsck -b 32768 /dev/sda3 

/or

  # e2fsck -b 32768 /dev/sda3 

, you will be prompted with questions to ignore error, answer "y", and for fix? answer "y", til its done.
and alternative is to use the:
 # fsck -y /dev/sda3 
, but this fixes the entire partition, try first the first one and use this only
as an option if that doesnt fix it, or if you know for sure why to.

5.) Now to test if it works, mount the partition:
# mount /dev/sda3 /mnt 
, if it mounts then its a good sign, you can do a further test
or do backups now,
$ cd /mnt
$ mkdir test
$ ls -l
# cp file /path/to/safe/location
for directory use
# cp -R /path/directory/ /path/destination

6.) Reboot.


LiveCD/USB Recommedations:

1.) System Rescue CD
2.) Trinity Rescue Kit
3.) Knoppix
4.) Zenwalk Live
5.) Finnix
6.) Kali/Backtrack Live
7.) Sabayon Live
8.) Linux Mint/LMDE Live

0 comments:

Post a Comment