Ubuntu 管理心得

搜尋此網誌

2021年2月18日 星期四

Shrink vmware vmdk size

 cf: https://blog.xuite.net/tolarku/blog/331992410-%E7%B8%AE%E5%B0%8F+VMDK+%E8%99%9B%E4%BD%94%E7%94%A8%E7%9A%84%E7%A9%BA%E9%96%93+-+shrink+a+thin+provisioned+disk

https://longfamily.pixnet.net/blog/post/350412959-vmware-virtual-disk-shrink-%E5%B0%87vmdk%E6%AA%94%E6%A1%88%E7%B8%AE%E5%B0%8F

  1. Assume that mydisk.vmdk is mounted on /dev/sda1 with directory /BACKUP
  2. Suppose 950GB to be shrink. Issue this:
    sudo dd bs=1M count=950000 if=/dev/zero of=/BACKUP/zero.dat status=progress
    This is for creating a 1M * 950000 = 950GB  zero filled file, zero.dat
  3. Then, delete this file,
    sudo /bin/rm -rf
    /BACKUP/zero.dat
  4. Close vmware-workstation and go back to host. Go to the vmdk file directory, say /vmware/mydisk.vmdk
  5. Make sure /vmware has doule size space of mydisk.vmdk because the following shrinking command will create another mydisk.vmdk.tmp file.
  6. sudo vmware-vdiskmanager -k mydisk.vmdk
  7. Go back to vmware-workstation. Click the 'Compact Disk' in the setting windows.
However, the process above can only reduce the logic size rather than the physical size of the hard disk. The vmdk is still of original size. One way to really reduce the vmdk is only to create another vmdk, say my60GB.vmdk.
  1. Use clonezilla to boot the vmware guest.
  2. Enter the expert mode,unclick and click options as follows:

  3. Start to disk to disk cloning.
  4. Done

沒有留言:

張貼留言

網誌存檔