mkfs command

CptCharis

Well-Known Member
Joined
Feb 27, 2018
Messages
562
Reaction score
465
Credits
970
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?
 


f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,900
Reaction score
3,527
Credits
35,667
I believe you may be looking for dumpe2fs(extX) or xfs_info(xfs)
 
OP
CptCharis

CptCharis

Well-Known Member
Joined
Feb 27, 2018
Messages
562
Reaction score
465
Credits
970
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
Joined
Dec 11, 2019
Messages
4,900
Reaction score
3,527
Credits
35,667
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
Joined
Dec 11, 2019
Messages
4,900
Reaction score
3,527
Credits
35,667
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
 
OP
CptCharis

CptCharis

Well-Known Member
Joined
Feb 27, 2018
Messages
562
Reaction score
465
Credits
970
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
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,900
Reaction score
3,527
Credits
35,667
nice, very nice but this is another way.
thanks a lot
I updated my other post with a link which you may find useful. Also here is the official documentation of the xfs filesystem. And with xfs_info and xfs_db you should be able to get the important information from the xfs filesystem.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Top