How to mount a filesystem from backup superblock location ?

Let us look how to mount a filesystem from backup superblock location.

In general this is not required, however sometimes in case you feel issue with primary superblock, this way you can prevent restart of your production server and remount it without check.

1. Check out filesystem which you want to mount from backup superblock.

[root@nglinux ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       7.8G  4.2G  3.3G  57% /
tmpfs           504M   72K  504M   1% /dev/shm
[root@nglinux ~]# 

 

2. Get backup superblock locations.

[root@nglinux ~]# dumpe2fs -h /dev/sda1 
dumpe2fs 1.41.12 (17-May-2010)
Filesystem volume name:   
Last mounted on:          /
Filesystem UUID:          edb49cd5-eff3-41e7-bb25-6f564ff4921f
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash 
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              524288
Block count:              2096474
Reserved block count:     104823
Free blocks:              950330
Free inodes:              380962
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      511
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Mon Apr 29 10:29:51 2019
Last mount time:          Tue Apr 30 13:37:59 2019
Last write time:          Mon Apr 29 11:17:01 2019
Mount count:              4
Maximum mount count:      25
Last checked:             Mon Apr 29 10:29:51 2019
Check interval:           15552000 (6 months)
Next check after:         Sat Oct 26 10:29:51 2019
Lifetime writes:          4624 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:	          256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
First orphan inode:       158323
Default directory hash:   half_md4
Directory Hash Seed:      ee88d347-10bf-4bb4-9230-4b81d94c7d65
Journal backup:           inode blocks
Journal features:         journal_incompat_revoke
Journal size:             128M
Journal length:           32768
Journal sequence:         0x00000448
Journal start:            1

### It is better to grep "superblock"
[root@nglinux ~]# dumpe2fs  /dev/sda1  | grep -i superblock
dumpe2fs 1.41.12 (17-May-2010)
  Primary superblock at 0, Group descriptors at 1-1
  Backup superblock at 32768, Group descriptors at 32769-32769
  Backup superblock at 98304, Group descriptors at 98305-98305
  Backup superblock at 163840, Group descriptors at 163841-163841
  Backup superblock at 229376, Group descriptors at 229377-229377
  Backup superblock at 294912, Group descriptors at 294913-294913
  Backup superblock at 819200, Group descriptors at 819201-819201
  Backup superblock at 884736, Group descriptors at 884737-884737
  Backup superblock at 1605632, Group descriptors at 1605633-1605633

 

3. Mount the filesystem from backup Superblock.

[root@nglinux ~]# mount -o -sb=163840 /dev/sda1 /mnt/
[root@nglinux ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       7.8G  4.2G  3.3G  57% /
tmpfs           504M   72K  504M   1% /dev/shm
/dev/sda1       7.8G  4.2G  3.3G  57% /mnt
[root@nglinux ~]# 

After it is mounted, you can restore whatever data you want.

Leave a Reply

avatar
  Subscribe  
Notify of