Linux下用fdisk命令和partprobe命令不重启系统新建分区并格式化(1)(3)
步骤还是和上面一样,分区、重载分区表、查看分区、格式化,这里不再按步骤,直接给出完成的操作记录。
- [root@stduy ~]# fdisk -l
- Disk /dev/sda: 21.5 GB, 21474836480 bytes
- 255 heads, 63 sectors/track, 2610 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0x000b604c
- Device Boot Start End Blocks Id System
- /dev/sda1 * 1 523 4194304 83 Linux
- Partition 1 does not end on cylinder boundary.
- /dev/sda2 523 784 2097152 82 Linux swap / Solaris
- Partition 2 does not end on cylinder boundary.
- /dev/sda3 784 2610 14672345 5 Extended
- /dev/sda5 784 2610 14672313+ 83 Linux
- Disk /dev/sdb: 5368 MB, 5368709120 bytes
- 255 heads, 63 sectors/track, 652 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0x00000000
- [root@stduy ~]# fdisk /dev/sdb
- Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
- Building a new DOS disklabel with disk identifier 0x851e79cc.
- Changes will remain in memory only, until you decide to write them.
- After that, of course, the previous content won't be recoverable.
- Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
- WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
- switch off the mode (command 'c') and change display units to
- sectors (command 'u').
- Command (m for help): p
- Disk /dev/sdb: 5368 MB, 5368709120 bytes
- 255 heads, 63 sectors/track, 652 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0x851e79cc
- Device Boot Start End Blocks Id System
- Command (m for help): n
- Command action
- e extended
- p primary partition (1-4)
- p
- Partition number (1-4): 1
- First cylinder (1-652, default 1):
- Using default value 1
- Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652):
- Using default value 652
- Command (m for help): p
- Disk /dev/sdb: 5368 MB, 5368709120 bytes
- 255 heads, 63 sectors/track, 652 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0x851e79cc
- Device Boot Start End Blocks Id System
- /dev/sdb1 1 652 5237158+ 83 Linux
- Command (m for help): w
- The partition table has been altered!
- Calling ioctl() to re-read partition table.
- Syncing disks.
- [root@stduy ~]# partprobe /dev/sdb
- [root@stduy ~]# mkfs -t ext4 /dev/sdb1
- mke2fs 1.41.12 (17-May-2010)
文件系统标签=操作系统:Linux块大小=4096 (log=2)分块大小=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks327680 inodes, 1309289 blocks65464 blocks (5.00%) reserved for the super user
第一个数据块=0Maximum filesystem blocks=134217728040 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736
正在写入inode表: 完成
- Creating journal (32768 blocks): 完成
- Writing superblocks and filesystem accounting information: 完成
- This filesystem will be automatically checked every 36 mounts or180 days, whichever comes first.
- Use tune2fs -c or -i to override.
这回不管是新建分区,还是重载分区表都没有警告或错误提示了。成功实现在不重启系统的情况下添加硬盘并对新增硬盘进行分区、格式化等操作。
评论暂时关闭