1. 程式人生 > >虛擬機收縮磁盤空間

虛擬機收縮磁盤空間

most borde all version ppr specific load cati 鏡像文件

虛擬機收縮磁盤空間

1.兩點註意事項

  • 想要對鏡像文件進行壓縮,要確認vmware中沒有該虛擬機的快照,否則無法進行壓縮。
  • 要進行鏡像文件的壓縮,必須確保存放虛擬機鏡像文件的電腦磁盤擁有至少和虛擬機鏡像文件大小相同的空閑空間,也就是說如果虛擬機的鏡像文件是20G,那麽存放該文件的磁盤必須有至少20G的空閑空間,因為壓縮過程的第一部分會生成鏡像文件的備份,空間不夠的話,最後會提示壓縮失敗。

2.操作步驟

技術分享圖片

安裝VMWareTool

1).關閉虛擬機的情況下,使用VMWareTool --VM--Install VMWareTool這時,VMWareTool工具安裝包,掛到虛擬光驅。

2).打開虛擬機,解壓tar包,安INSTALL說明文件,安裝VMWareTool。

使用vmware-toolbox-cmd收縮磁盤


1).列出所有可用命令:

[root@testo ~]# vmware-toolbox-cmd help
Usage: vmware-toolbox-cmd [options] [subcommand]
Type ‘vmware-toolbox-cmd help ‘ for help on a specific command.
Type ‘vmware-toolbox-cmd -v‘ to see the VMware Tools version.
Use ‘-q‘ option to suppress stdout output.
Most commands take a subcommand.

Available commands:
device
disk
script
stat
timesync
upgrade (not available on all operating systems)


2).磁盤相關的命令:

[root@testo ~]# vmware-toolbox-cmd help disk
disk: perform. disk shrink operations
Usage: vmware-toolbox-cmd disk [args]

Subcommands:
list: list available locations
shrink : wipes and shrinks a file system at the given location
shrinkonly: shrinks all disks
wipe : wipes a file system at the given location


3).列出可收縮的分區:
[root@testo ~]# vmware-toolbox-www.taohuayuan178.com cmd disk list
/
/boot
/home
/u01

4).收縮分區:
[root@testo ~]# vmware-toolbox-cmd disk www.boshenyl.cn shrink /home
Please disregard any warnings about disk space for the duration of shrink process.
Progress: 100www.longboshyl.cn [===========>]
Disk shrinking complete.

完畢!

虛擬機收縮磁盤空間