菜鳥學習---虛擬機添硬盤分區並掛載
阿新 • • 發佈:2017-09-26
parted 8t
最近學習分區的時候,請教了一個朋友,相對於他,我是要膜拜的,他提到了說現在在實操操作中,很少會在一塊硬盤上分很多個區,現在實際生產中都是以“T”開頭的,所以說我可以學習一下parted進行分區(parted分區默認為G),然後在網上看了一些文檔,然後結合自己的系統進行分區掛載等操作。
首先虛擬機上新添加了一個8T的硬盤,添加完成後重新啟動一下虛擬機,
查看現在分區
[[email protected] ]# fdisk -l Disk /dev/sda: 64.4 GB, 64424509440 bytes 255 heads, 63 sectors/track, 7832 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 /dev/sdb: 8589.9 GB, 8589934592000 bytes 255 heads, 63 sectors/track, 1044333 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
Disk /dev/sdb: 8589.9 GB 顯示我現在新添加的硬盤為8T
我現在要把這8T的硬盤進行分區
#對/dev/sdb進行分區(8T)
[[email protected] /]# parted /dev/sdb GNU Parted 2.1 Using /dev/sdb Welcome to GNU Parted! Type ‘help‘ to view a list of commands
#因為新掛的硬盤,類似於windows下分區,轉換為gpt格式
#關於MBR格式和GPT格式的優缺點可以自己百度。
(parted) mklabel gpt
# 劃分一個200G的主分區
(parted) mkpart primary ext4 Start? 1 End? 200
# 劃分第二分區
(parted) mkpart Partition name? []? #分區名稱,可以直接回車 File system type? [ext2]? #分區格式可以設置,默認是ext2,現在可以直接回車,一會要格式化 Start? 201 End? 7700 Warning: You requested a partition from 201MB to 7700GB. The closest location we can manage is 200GB to 7700GB. Is this still acceptable to you? #是否確定這樣分區 Yes/No? y #確認 #劃分第三個分區 (parted) mkpart Partition name? []? File system type? [ext2]? Start? 8001 End? 8589.9 Warning: You requested a partition from 8001MB to 8590MB. The closest location we can manage is 8000GB to 8000GB. Is this still acceptable to you? Yes/No? y Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? i #顯示/dev/sdb下劃分的分區 (parted) p Model: VMware, VMware Virtual S (scsi) Disk /dev/sdb: 8590GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 200GB 200GB primary 2 200GB 8000GB 7800GB 3 8000GB 8000GB 512B
#大家從上面可以看到我第三個分區是錯識的,因為我第三個分區是從8t的位置開始,然後8t的位置結束,
所以就會出現第三個分區的大小為512b,所以就有下面的操作(第二塊分區的結束位置是7800,那麽第三塊應該是從7801開始)。
本文出自 “菜鳥八哥” 博客,轉載請與作者聯系!
菜鳥學習---虛擬機添硬盤分區並掛載