mkfs command

CptCharis

Well-Known Member
Credits
350
I am trying to check where backup block of file system are exist with mke2fs command:
According this :

Causes mke2fs to not actually create a filesystem, but display what it would do if it were to create a filesystem. This can be used to determine the location of the backup superblocks for a particular filesystem, so long as the mke2fs parameters that were passed when the filesystem was originally created are used again. (With the -n option added, of course!)
So
Code:
sudo mke2fs -n /dev/sda1
mke2fs 1.44.3 (10-July-2018)
/dev/sda1 contains a ext4 file system
    last mounted on /boot on Sat Aug  8 17:11:47 2020
Proceed anyway? (y,N) n
why is trying to make a file system?
 


CptCharis

Well-Known Member
Credits
350
I believe you may be looking for dumpe2fs(extX) or xfs_info(xfs)
Not sure let me explain
I was watching youtube tutorials and I saw that command
Code:
e2fsck -f -b backup_superbolock device
can restore a corrupted file system, using the back up superblocks that have been created during creating filing system.
Googling around how to find where this superblocks are located i found that command
Code:
mke2fs -n
will not create a new file system but it will show where superblocks are located, according man pages
Causes mke2fs to not actually create a filesystem, but display what it would do if it were to create a filesystem. This can be used to determine the location of the backup superblocks for a particular filesystem, so long as the mke2fs parameters that were passed when the filesystem was originally created are used again. (With the -n option added, of course!)

So I am just wondering if I use the command wrongly.
 

f33dm3bits

Gold Member
Gold Supporter
Credits
3,384
Why would you manually want to backup the superblocks, normally if a filesystem gets corrupted it will do a fsck on boot and try to recover it. If that doesn't work there are tools to repair a corrupted filesystem without needing to make a manual backup of the superblocks.
 
Last edited:

f33dm3bits

Gold Member
Gold Supporter
Credits
3,384
Code:
]# dumpe2fs /dev/vg_rhel6/lv_root  | 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
 

CptCharis

Well-Known Member
Credits
350
Code:
]# dumpe2fs /dev/vg_rhel6/lv_root  | 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
nice, very nice but this is another way.
thanks a lot
 


Staff online


Latest posts

Top