
先查看一下我们的设备:
root@xiahuixia-Inspiron-3437:/home/xiahuixia/tmp# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 476559384 13315584 439012940 3% /
none 40 4 0% /sys/fs/cgroup
udev 19643124 1964308 1% /dev
tmpfs 395000 1360393640 1% /run
none51200 5120 0% /run/lock
none 197498417240 1957744 1% /run/shm
none 102400 36102364 1% /run/user
root@xiahuixia-Inspiron-3437:/home/xiahuixia/tmp#
ok, 有一个设备叫做/dev/sda1,是的,它就是我的硬盘了,我没有把我的硬盘分区,所以只有一个/dev/sda1 ,没有/dev/sda2 、/dev/sda3….
然后查看一下这个命令“dumpe2fs”(dump ext2 file system , ext2文件系统是linux的正规文件系统)
DUMPE2FS(8) System Manager's ManualDUMPE2FS(8)
NAME
dumpe2fs - dump ext2/ext3/ext4 filesystem information
SYNOPSIS
dumpe2fs [ -bfhixV ] [ -o superblock=superblock ] [ -o blocksize=block‐ size ] device
DESCRIPTION
dumpe2fs prints the super block and blocks group information for the filesystem present on device.
Note: When used with a mounted filesystem, the printed information may be old or inconsistent.
OPTIONS
-b print the blocks which are reserved as bad in the filesystem.
-o superblock=superblock
use the block superblock when examining the filesystem.This option is not usually needed except by a filesystem wizard who is examining the remains of a very badly corrupted filesystem.
至于man手册开头的DUMPE2FS(8), 8是什么意思呢?
再执行man man 看一下:
The table below shows the section numbers of the manual followed by the types of pages they contain.
1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
A manual page consists of several sections.
看到了吗? 8 System administration commands (usually only for root)
好了,回到命令dumpe2fs来,dumpe2fs dev, 那么,这个dev该用什么来代替呢?就是我们的设备/dev/sda1了。
好了,看一下我们超级块的样子:
dumpe2fs /dev/sda1, oop!内容太多了,将内容重定向到文件里吧:
dumpe2fs /dev/sda1 >input
vi input
let us have a look at the content of input:
Filesystem volume name: <none>
Last mounted on: /
Filesystem UUID: 83a4e993-4703-42ac-88ce-81f7b8c5ae35
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:user_xattr acl
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 30269440
Block count: 121072384
Reserved block count: 6053619
Free blocks: 115812611
Free inodes: 30026282
First block: 0
Block size: 4096
Fragment size:4096
Reserved GDT blocks: 995
Blocks per group: 32768
超级块(SuperBlock)包括文件系统的总体信息,比如大小(其准确信息依赖文件系统)。MBR(MasterBootRecord),中文意为主引导记录。硬盘的0磁道的第一个扇区称为MBR,它的大小是512字节,而这个区域可以分为两个部分。第一部分为pre-boot区(预启动区),占446字节;第二部分是Partitiontable区(分区表),占66个字节,该区相当于一个小程序,作用是判断哪个分区被标记为活动分区,然后去读取那个分区的启动区,并运行该区中的代码。他是不属于任何一个 *** 作系统,也不能用 *** 作系统提供的磁盘 *** 作命令来读取它。但我们可以用ROM-BIOS中提供的INT13H的2号功能来读出该扇区的内容,也可用软件工具Norton8.0中的DISKEDIT.EXE来读取。附:liunx和unix是为了做服务器用途的,它必须保证365*24运行,它的设计就决定不需要整理磁盘碎片。一个分区或磁盘能作为文件系统使用前,需要初始化,并将记录数据结构写到磁盘上。这个过程就叫建立文件系统。大部分UNIX文件系统种类具有类似的通用结构,即使细节有些变化。其中心概念是超级块superblock,i节点inode,数据块datablock,目录块directoryblock,和间接块indirectionblock。超级块包括文件系统的总体信息,比如大小(其准确信息依赖文件系统)。i节点包括除了名字外的一个文件的所有信息,名字与i节点数目一起存在目录中,目录条目包括文件名和文件的i节点数目。i节点包括几个数据块的数目,用于存储文件的数据。i节点中只有少量数据块数的空间,如果需要更多,会动态分配指向数据块的指针空间。这些动态分配的块是间接块;为了找到数据块,这名字指出它必须先找到间接块的号码。UNIX文件系统通常允许在文件中产生孔(hole),意思是文件系统假装文件中有一个特殊的位置只有0字节,但没有为这文件的这个位置保留实际的磁盘空间(这意味着这个文件将少用一些磁盘空间)。这对小的二进制文件经常发生,Linux共享库、一些数据库和其他一些特殊情况。(孔由存储在间接块或i节点中的作为数据块地址的一个特殊值实现,这个特殊地址说明没有为文件的这个部分分配数据块,即,文件中有一个孔。)欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)