步骤还是和上面一样,分区、重载分区表、查看分区、格式化,这里不再按步骤,直接给出完成的操作记录。

  1. [root@stduy ~]# fdisk -l  
  2.  
  3. Disk /dev/sda: 21.5 GB, 21474836480 bytes  
  4. 255 heads, 63 sectors/track, 2610 cylinders  
  5. Units = cylinders of 16065 * 512 = 8225280 bytes  
  6. Sector size (logical/physical): 512 bytes / 512 bytes  
  7. I/O size (minimum/optimal): 512 bytes / 512 bytes  
  8. Disk identifier: 0x000b604c  
  9.  
  10. Device Boot Start End Blocks Id System  
  11. /dev/sda1 * 1 523 4194304 83 Linux  
  12. Partition 1 does not end on cylinder boundary.  
  13. /dev/sda2 523 784 2097152 82 Linux swap / Solaris  
  14. Partition 2 does not end on cylinder boundary.  
  15. /dev/sda3 784 2610 14672345 5 Extended  
  16. /dev/sda5 784 2610 14672313+ 83 Linux  
  17.  
  18. Disk /dev/sdb: 5368 MB, 5368709120 bytes  
  19. 255 heads, 63 sectors/track, 652 cylinders  
  20. Units = cylinders of 16065 * 512 = 8225280 bytes  
  21. Sector size (logical/physical): 512 bytes / 512 bytes  
  22. I/O size (minimum/optimal): 512 bytes / 512 bytes  
  23. Disk identifier: 0x00000000  
  24.  
  25. [root@stduy ~]# fdisk /dev/sdb  
  26. Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel  
  27. Building a new DOS disklabel with disk identifier 0x851e79cc.  
  28. Changes will remain in memory only, until you decide to write them.  
  29. After that, of course, the previous content won't be recoverable.  
  30.  
  31. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)  
  32.  
  33. WARNING: DOS-compatible mode is deprecated. It's strongly recommended to  
  34. switch off the mode (command 'c') and change display units to  
  35. sectors (command 'u').  
  36.  
  37. Command (m for help): p  
  38.  
  39. Disk /dev/sdb: 5368 MB, 5368709120 bytes  
  40. 255 heads, 63 sectors/track, 652 cylinders  
  41. Units = cylinders of 16065 * 512 = 8225280 bytes  
  42. Sector size (logical/physical): 512 bytes / 512 bytes  
  43. I/O size (minimum/optimal): 512 bytes / 512 bytes  
  44. Disk identifier: 0x851e79cc  
  45.  
  46. Device Boot Start End Blocks Id System  
  47.  
  48. Command (m for help): n  
  49. Command action  
  50. e extended  
  51. p primary partition (1-4)  
  52. p  
  53. Partition number (1-4): 1  
  54. First cylinder (1-652, default 1):   
  55. Using default value 1  
  56. Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652):   
  57. Using default value 652  
  58.  
  59. Command (m for help): p  
  60.  
  61. Disk /dev/sdb: 5368 MB, 5368709120 bytes  
  62. 255 heads, 63 sectors/track, 652 cylinders  
  63. Units = cylinders of 16065 * 512 = 8225280 bytes  
  64. Sector size (logical/physical): 512 bytes / 512 bytes  
  65. I/O size (minimum/optimal): 512 bytes / 512 bytes  
  66. Disk identifier: 0x851e79cc  
  67.  
  68. Device Boot Start End Blocks Id System  
  69. /dev/sdb1 1 652 5237158+ 83 Linux  
  70.  
  71. Command (m for help): w  
  72. The partition table has been altered!  
  73.  
  74. Calling ioctl() to re-read partition table.  
  75. Syncing disks.  
  76. [root@stduy ~]# partprobe /dev/sdb  
  77. [root@stduy ~]# mkfs -t ext4 /dev/sdb1  
  78. 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表: 完成

  1. Creating journal (32768 blocks): 完成  
  2. Writing superblocks and filesystem accounting information: 完成  
  3. This filesystem will be automatically checked every 36 mounts or180 days, whichever comes first.   
  4. Use tune2fs -c or -i to override. 

这回不管是新建分区,还是重载分区表都没有警告或错误提示了。成功实现在不重启系统的情况下添加硬盘并对新增硬盘进行分区、格式化等操作。


相关内容