-
在虛擬機(jī)未啟動(dòng)狀態(tài)下點(diǎn)擊編輯虛擬機(jī)設(shè)置斑举,在彈出框中選擇添加搅轿。在彈出框中選中硬盤,根據(jù)需求選擇即可富玷。
image - 啟動(dòng)虛擬機(jī)璧坟,在虛擬機(jī)中查看硬盤信息
# sudo fdisk -l
Disk /dev/sda: 60 GiB, 64424509440 bytes, 125829120 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xcb6d7a7d
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 391167 389120 190M 83 Linux
/dev/sda2 393214 125827071 125433858 59.8G 5 Extended
/dev/sda5 393216 30390271 29997056 14.3G 83 Linux
/dev/sda6 30392320 46397439 16005120 7.6G 82 Linux swap / Solaris
/dev/sda7 46399488 125827071 79427584 37.9G 83 Linux
Disk /dev/sdb: 350 GiB, 375809638400 bytes, 734003200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd868f2b3
- 分區(qū)命令:
fdisk可以用m命令來看fdisk命令的內(nèi)部命令;
a:命令指定啟動(dòng)分區(qū)赎懦;
d:命令刪除一個(gè)存在的分區(qū)雀鹃;
l:命令顯示分區(qū)ID號的列表;
m:查看fdisk命令幫助励两;
n:命令創(chuàng)建一個(gè)新分區(qū)黎茎;
p:命令顯示分區(qū)列表;
t:命令修改分區(qū)的類型ID號当悔;
w:命令是將對分區(qū)表的修改存盤讓它發(fā)生作用傅瞻。
- 進(jìn)入磁盤進(jìn)行分區(qū)
Command (m for help):n
Command action
e extended //輸入e為創(chuàng)建擴(kuò)展分區(qū)
p primary partition (1-4) //輸入p為創(chuàng)建邏輯分區(qū)
p
Partion number(1-4):1 //在這里輸入l,就進(jìn)入劃分邏輯分區(qū)階段了盲憎;
First cylinder (51-125, default 51): //注:這個(gè)就是分區(qū)的Start 值嗅骄;這里最好直接按回車,如果您輸入了一個(gè)非默認(rèn)的數(shù)字饼疙,會(huì)造成空間浪費(fèi)溺森;
Using default value 51
Last cylinder or +size or +sizeM or +sizeK (51-125, default 125): +200M 注:這個(gè)是定義分區(qū)大小的,+200M 就是大小為200M 窑眯;當(dāng)然您也可以根據(jù)p提示的單位cylinder的大小來算屏积,然后來指定 End的數(shù)值∩斓回頭看看是怎么算的肾请;還是用+200M這個(gè)辦法來添加,這樣能直觀一點(diǎn)更胖。如果您想添加一個(gè)10G左右大小的分區(qū),請輸入 +10000M 隔显;
Command (m for help): w //最后輸入w回車保存却妨。
- 查看分區(qū)情況并格式化分區(qū):
# fdisk -l
# mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
文件系統(tǒng)標(biāo)簽=
操作系統(tǒng):Linux
塊大小=4096 (log=2)
分塊大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
640848 inodes, 2562359 blocks
128117 blocks (5.00%) reserved for the super user
第一個(gè)數(shù)據(jù)塊=0
Maximum filesystem blocks=2625634304
79 block groups
32768 blocks per group, 32768 fragments per group
8112 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
正在寫入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
- 掛載分區(qū)
# mkdir ~/work
# mount /dev/sdb1 ~/work
# df -h //查看配置情況
- 配置開機(jī)自動(dòng)掛載并重啟
#sudo vim /etc/fstab
添加:
/dev/sdb1 /home/mozre/work ext4 defaults 0 0
# sudo reboot