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

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

[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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值