技术头条 - 一个快速在微博传播文章的方式     搜索本站
您现在的位置首页 --> 系统运维 --> Linux下硬盘格式化的相关命令Partprobe

Linux下硬盘格式化的相关命令Partprobe

浏览:1725次  出处信息

这几天格式化硬盘,记录一下用到的命令:

    [root@db ~]# fdisk /dev/sdb

    The number of cylinders for this disk is set to 253981.

    There is nothing wrong with that, but this is larger than 1024,

    and could in certain setups cause problems with:

    1) software that runs at boot time (e.g., old versions of LILO)

    2) booting and partitioning software from other OSs

     (e.g., DOS FDISK, OS/2 FDISK)

    Command (m for help): p

    Disk /dev/sdb: 2089.0 GB, 2089072092672 bytes

    255 heads, 63 sectors/track, 253981 cylinders

    Units = cylinders of 16065 * 512 = 8225280 bytes

     Device Boot      Start         End      Blocks   Id  System

    /dev/sdb1               1      124495  1000006056   83  Linux

    Command (m for help): n

    Command action

     e   extended

     p   primary partition (1-4)

    p

    Partition number (1-4): 2

    First cylinder (124496-253981, default 124496):

    Using default value 124496

    Last cylinder or +size or +sizeM or +sizeK (124496-253981, default 253981):

    Using default value 253981

    Command (m for help): p

    Disk /dev/sdb: 2089.0 GB, 2089072092672 bytes

    255 heads, 63 sectors/track, 253981 cylinders

    Units = cylinders of 16065 * 512 = 8225280 bytes

     Device Boot      Start         End      Blocks   Id  System

    /dev/sdb1               1      124495  1000006056   83  Linux

    /dev/sdb2          124496      253981  1040096295   83  Linux

    Command (m for help): w

    The partition table has been altered!

    Calling ioctl() to re-read partition table.

    WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

    The kernel still uses the old table.

    The new table will be used at the next reboot.

    Syncing disks.

    此时,分区里看不到新建的磁盘分区,提示通过重启才可以重用分区表,此时可以通过partprobe探测硬盘:

    [root@db ~]# ls -al /dev/sdb*

    brw-rw----  1 root disk 8, 16 Jun 25 04:40 /dev/sdb

    brw-rw----  1 root disk 8, 17 Jun 29 22:07 /dev/sdb1

    [root@db ~]# partprobe

    [root@db ~]# ls -al /dev/sdb*

    brw-rw----  1 root disk 8, 16 Jun 25 04:40 /dev/sdb

    brw-rw----  1 root disk 8, 17 Jun 29 22:07 /dev/sdb1

    brw-rw----  1 root disk 8, 18 Jul  2 22:37 /dev/sdb2

    分区容量:

    [root@db ~]# mkfs /dev/sdb2

    mke2fs 1.35 (28-Feb-2004)

    Filesystem label=

    OS type: Linux

    Block size=4096 (log=2)

    Fragment size=4096 (log=2)

    130023424 inodes, 260024073 blocks

    13001203 blocks (5.00%) reserved for the super user

    First data block=0

    Maximum filesystem blocks=4294967296

    7936 block groups

    32768 blocks per group, 32768 fragments per group

    16384 inodes per group

    Superblock backups stored on blocks:

     32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

     4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,

     102400000, 214990848

    Writing inode tables: 4076/7936

    .done                           

    Writing superblocks and filesystem accounting information:

    .done

    This filesystem will be automatically checked every 20 mounts or

    180 days, whichever comes first.  Use tune2fs -c or -i to override.

    此时可以正常使用该磁盘分区了。

    [root@db ~]# sfdisk -l /dev/sdb

    Disk /dev/sdb: 253981 cylinders, 255 heads, 63 sectors/track

    Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

     Device Boot Start     End   #cyls    #blocks   Id  System

    /dev/sdb1          0+ 124494  124495- 1000006056   83  Linux

    /dev/sdb2     124495  253980  129486  1040096295   83  Linux

    /dev/sdb3          0       -       0          0    0  Empty

    /dev/sdb4          0       -       0          0    0  Empty

建议继续学习:

  1. perl的格式化(Format)报表输出    (阅读:2338)
QQ技术交流群:445447336,欢迎加入!
扫一扫订阅我的微信号:IT技术博客大学习
后一篇:VPS完全指南 >>
© 2009 - 2024 by blogread.cn 微博:@IT技术博客大学习

京ICP备15002552号-1