2016年5月25日 星期三

[VirtualBox] 調整CentOS VM硬碟大小配置


VM配置的硬碟不夠用了,懶得重開重灌,因此決定增加硬碟的配置



環境:Windows 7下執行VirtualBox

首先以系統管理員執行cmd,進入VirtualBox安裝路徑
cd C:\Program Files\Oracle\VirtualBox

VBoxManage modifyhd "虛擬硬碟名稱.vdi" - - resize 新大小(MB)
[ex] VBoxManage modifyhd "D:\VirtualBox\VirtualBox VMs\CentOS 7 D" --resize 12288

接下來進入VM以root執行以下指令


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
df
fdisk -l
fdisk /dev/sda
d
2
n
p
2
<return>
<return>
w
reboot
pvresize /dev/sda2
pvscan
lvextend -l +100%FREE /dev/mapper/centos-root
xfs_growfs /dev/mapper/centos-root
df



最後感謝宅宅學弟的幫忙,他一開說只有87%的機率會成功
結果毀了我一個VM後,終於在第二個VM成功了!(灑花)
http://syuanme.blogspot.tw/



[Reference]
VirtualBox 增加虛擬機器的硬碟空間 – CentOS
http://ims.tw/archives/1017

VirtualBox: Increase Size of RHEL/Fedora/CentOS/Scientific Guest File System
https://blog.jyore.com/2013/06/virtualbox-increase-size-of-rhelfedoracentosscientificos-guest-file-system/



沒有留言: