曲径通幽论坛

 找回密码
 立即注册
搜索
查看: 6407|回复: 0
打印 上一主题 下一主题

磁盘操作相关指令:fdisk, partprobe, mke2fs, dumpe2fs

[复制链接]

4918

主题

5880

帖子

3万

积分

GROAD

曲径通幽,安觅芳踪。

Rank: 6Rank: 6

积分
34397
跳转到指定楼层
楼主
发表于 2008-12-2 16:34:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
加入用 fdisk分出一块分区后,程序是会提示需要重启电脑后才能使分区生效。其实也可以无需重启,而直接进行格式化然后使用,方法是执行下面的指令:

partprobe                 /* inform the OS of partition table changes 通知系统分区表要改变了*/

mke2f /dev/sda6   /*假设 sda6 就是新划分出来的分区*/


mke2fs [options] device
      Options
    a   toggle a bootable flag   将分区设置为启动区   b   edit bsd disklabel    编辑bsd的disklabel   c   toggle the dos compatibility flag  设置该分区为dos分区   d   delete a partition 删除分区   l   list known partition types  列出已知的分区类型   m   print this menu  打印帮助列表   n   add a new partition 创建新分区   o   create a new empty DOS partition table   p   print the partition table 查看分区信息   q   quit without saving changes 退出不保存   s   create a new empty Sun disklabel   t   change a partition's system id 改变分区类型   u   change display/entry units   v   verify the partition table   w   write table to disk and exit 保存退出   x   extra functionality (experts only)   




    一个分区中,起始的块为启动扇区(boot sector)。

    一定数量的块(blocks)组成一个块组(group)

    在第一个组中的第一个 block 称之为 super block ,里面记录着这个分区里总共分为多少个块,有多少个inode等信息。

    如果 super-block 损毁,那么这个分区就无法存储数据,所以在每个 block group 的第一个block都作为一个 super-block 的一个备份( super block bakcup )。



    分区的相关信息,用 dumpe2fs 命令查看,如执行一下指令:

    dumpe2fs /dev/sdc10                      /*以我的分根区为例*/

    结果显示(部分):
    Filesystem state:         clean
    Errors behavior:          Continue
    Filesystem OS type:       Linux
    Inode count:              1302528
    Block count:              5201035
    Reserved block count:     260051
    Free blocks:              3142288
    Free inodes:              955300
    First block:              0
    Block size:               4096
    Fragment size:            4096
    Reserved GDT blocks:      1022
    Blocks per group:         32768
    Fragments per group:      32768
    Inodes per group:         8192
    Inode blocks per group:   512
    Filesystem created:       Sat Nov 29 17:24:28 2008
    Last mount time:          Mon Dec  1 23:01:14 2008
    Last write time:          Mon Dec  1 23:01:14 2008

    接着是 super-block 的内容:
    First inode:              11
    Inode size:              256
    Required extra isize:     28
    Desired extra isize:      28
    Journal inode:            8
    First orphan inode:       90218
    Default directory hash:   half_md4
    Directory Hash Seed:      44904a45-e11f-4979-bf04-017f58edb455
    Journal backup:           inode blocks
    Journal size:             128M

    在接着就是 group 的详细信息(部分):
    Group 0: (Blocks 0-32767)
      Primary superblock at 0, Group descriptors at 1-2
      Reserved GDT blocks at 3-1024
      Block bitmap at 1025 (+1025), Inode bitmap at 1026 (+1026)
      Inode table at 1027-1538 (+1027)
      23572 free blocks, 7969 free inodes, 2 directories
      Free blocks: 1722-2047, 2213-4095, 4099-6143, 6222-8191, 10080-10239, 11578-12287, 12758-14335,
    16385-16391, 17215-18431, 18819-20479, 20482-22527, 22589-26623, 26730-28671, 28673-30719, 30823
    -32767
      Free inodes: 224-8192
    Group 1: (Blocks 32768-65535)
      Backup superblock at 32768, Group descriptors at 32769-32770
      Reserved GDT blocks at 32771-33792
      Block bitmap at 33793 (+1025), Inode bitmap at 33794 (+1026)
      Inode table at 33795-34306 (+1027)
    ......
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|曲径通幽 ( 琼ICP备11001422号-1|公安备案:46900502000207 )

GMT+8, 2025-6-18 03:57 , Processed in 0.081478 second(s), 22 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表