View the superblock of the ext3 file system partition
Source: Internet
Author: User
This article describes how to read the superblock of a partition: 1. first, let's look at the partitions on the disk. There are three partitions through fdisk-l. we can see/dev/sda3 (this is a devicefile) 2. copy 1024B-2048B from/dev/sda3 (this is superbl...
This article describes how to read the superblock of a partition:
1. First, let's look at the partitions on the disk, through fdisk-l
There are three partitions, and we can see/dev/sda3 (this is a device file) 2. copy 1024B-2048B from/dev/sda3 (this is the location of superblock) to a file named superblock
Here we use the dd tool, which is very useful for such read/write operations on disks. for details, see man. Bs = 1 k the size of each read/write block skip = 1 offset number of blocks to start reading (here the block is bs = 1 k, offset 1, indicating reading starts from 1 k) count = the size of 1 read (1 k read here) if, of indicates where to read and where to write respectively. Here, you may ask why you want to start reading from 1 K and read the size of 1 K? Is the physical storage structure of a partition:
We can see that the first 1 k of the first Block is the stored Boot Block, while the superblock starts from 1 k and the size is 1 k. 3. view the superblock file. use vim to open the superblock file we just copied from/dev/sda3. because it is a binary file, we should use: % after opening it with vim! Xxd to hexadecimal format. Here we have seen the form of superblock on the disk. Next I want to verify the correctness of a superblock. First, view the struct ext3_super_block in the/usr/include/linux/ext3_fs.h header file:
We can know that the superblock header records the number of inodes and the number of blocks, which are 32 bits. From the superblock, we can see that inodes_count: 0000 3a04 (note: Here is the decimal end)-> 043a0000 = 70909952blocks_count: fdc4 3904-> 0439c4fd = 70894845
How can we verify this result? Linux provides the dumpe2fs tool: dumpe2fs/dev/sda3 | less we can see the following output (part)
Here, we have finished all the methods for viewing superblock. we can also use dd to view any part of the disk.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service