Меню Рубрики

Vmware disk shrink linux

Vmware disk shrink linux

Shrinking a virtual disk reclaims unused space in the virtual disk and reduces the amount of space that the virtual disk occupies on the host.

Shrinking disks is not allowed under the following circumstances:

  • The virtual machine is hosted on an ESX/ESXi host. ESX/ESXi can shrink the size of a virtual disk only when a virtual machine is exported. The space occupied by the virtual disk on the server, however, does not change.
  • The virtual machine has a Mac OS X guest operating system.
  • You preallocated all the disk space to the virtual disk when you created it.
  • The virtual machine contains a snapshot.

The exception is if the virtual machine is used in VMware Fusion 4 and has a Windows guest operating system. In this case, you can use the Clean Up Virtual Machine feature in Fusion to shrink disks.

  • The virtual machine is a linked clone or the parent of a linked clone.
  • The virtual disk is an independent disk in nonpersistent mode.
  • The file system is a journaling file system, such as an ext4 , xfs , or jfs file system.
  • Shrinking a disk is a two-step process. In the preparation step, VMware Tools reclaims all unused portions of disk partitions, such as deleted files, and prepares them for shrinking. This phase takes place in the guest operating system. During this phase, you can still interact with the virtual machine.

    In the shrink step, the VMware application reduces the size of the disk based on the disk space reclaimed during the preparation step. If the disk has empty space, this process reduces the amount of space the virtual disk occupies on the host drive. The shrink step takes place outside the virtual machine and takes considerable time, depending on the size of the disk. The virtual machine stops responding while VMware Tools shrinks the disks.

    Newer versions of some VMware products might include a button or menu item that performs the same function as the shrink-disk command. For example, Workstation includes a Compact menu item that you can use when the virtual machine is powered off. VMware Fusion 4 includes a Clean Up Virtual Machine button that can shrink disks even if you have snapshots.

    Under some conditions, the ability to use a shrink-disk command might be considered a security risk. To configure a setting that disables the ability to shrink disk, see Threats Associated with Unprivileged User Accounts.

    Prerequisites

    • On Linux, Solaris, and FreeBSD guest operating systems, log in as root. If you shrink the virtual disk as a nonroot user, you cannot prepare to shrink the parts of the virtual disk that require root-level permissions.
    • On Windows guests, log in as an administrator.
    • Verify that the host has free disk space equal to the size of the virtual disk that you plan to shrink.

    Procedure

    1. Open a command prompt or terminal in the guest operating system.
    2. Change to the VMware Tools installation directory.
      Operating System Default Path
      Windows C:\Program Files\VMware\VMware Tools
      Linux and Solaris /usr/sbin
      FreeBSD /usr/local/sbin
      Mac OS X /Library/Application Support/VMware Tools
    3. Type the command to list available mount points.

    For utility-name use the guest-specific program name.

    Operating System Utility Name
    Windows VMwareToolboxCmd.exe
    Linux, Solaris, and FreeBSD vmware-toolbox-cmd

    Type the command to shrink the disk at a specified mount point.

    For mount-point , use one of the mount points displayed when you used the list subcommand.

    Источник

    How to shrink a VMWare Fusion Linux virtual disk

    VMWare Fusion on Mac OSX allows you to shrink virtual disks easily for Windows virtual machines right from the graphical interface (Virtual Machine -> Settings -> General -> Clean Up Virtual Machine) but there isn’t the same option to do this with Linux, so you need to do it from the command line.

    1. Clean up space

    First of all you should clean up whatever space you can on the Linux virtual machine by deleting uncessary files, etc. After doing that, run this command as the root user on the Linux VM to zero out any free space – if you don’t do it, then the shrinking process won’t reclaim any space:

    You’ll see this message when it has finished:

    That’s OK, because the idea was to fill the disk up and then delete the file afterwards.

    2. Shut down the virtual machine

    You can’t reclaim space with the virtual machine running, so shut it down first.

    3. Run the shrinking process

    Open up Terminal on your Mac, change to the directory the virtual machine files are in (for example I have mine at

    /Virtual Machines/ ) and then run the following commands, replacing «Virtual Disk.vmdk» with the actual name of your virtual disk image.

    Note that if the filename contains spaces then the filename parameter to the command needs quotes around it, as in my examples.

    The following examples assume VMWare Fusion is installed in Applications at the OSX disk root.

    The first command defragments the disk:

    I got the message «VixDiskLib: Invalid configuration file parameter. Failed to read configuration file.» when running this command. I don’t know what this error means, but the command worked successfully and this was the other output:

    The second command then shrinks the disk:

    Once again, I got the message «VixDiskLib: Invalid configuration file parameter. Failed to read configuration file.» but again it all worked fine, and this was the output

    I managed to reclaim 9GB of wasted space from doing this.

    What is the virtual disk filename?

    When you do a directory listing, you’ll see a bunch of files and directories like this:

    The disk images have the .vmdk file extension and in the above example have been split into 11 different files with numbered filenames. You don’t need to defrag and shrink the numbered filenames, just the one without the numbers.

    So in the above example, ignore Virtual Disk-s001.vmdk to Virtual Disk-s011.vmdk and run the command on Virtual Disk.vmdk.

    If you do attempt to run the command on one of the numbered files, you’ll get an error message like this one:

    Version used

    I ran the above commands on VMWare Fusion 7.1.1 on OSX Yosemite 10.10.3.

    Источник

    VMware Workstation 5.0

    Shrinking Virtual Disks

    If you have a virtual disk that grows as data is added, you can shrink it as described in this section. If you allocated all the space for your virtual disk at the time you created it, you cannot shrink it.

    Note: The maximum benefit occurs when you defragment a virtual disk before you shrink it. See Defragmenting Virtual Disks.

    Shrinking a virtual disk reclaims unused space in the virtual disk. If there is empty space in the disk, this process reduces the amount of space the virtual disk occupies on the host drive.

    Shrinking a virtual disk is a convenient way to convert a virtual disk to the format supported by Workstation. Virtual disks created in the new format can be recognized only by VMware Workstation 3.0 and higher.

    This section describes the following topics:

    Restrictions and Requirements

    Shrinking requires free disk space on the host equal to the size of the virtual disk you are shrinking.

    Shrinking applies only to virtual disks. You cannot shrink physical disks or CD-ROMs.

    The shrink feature is not enabled if the virtual machine

    The shrink feature is not enabled for a virtual machine if any of its virtual disks are

    Note: You can change the mode of a virtual disk before the virtual machine is powered on. See Excluding Disks from Snapshots for a discussion of independent disks.

    The Shrinking Process

    Shrinking a disk is a two-step process:

    When a virtual machine is powered on, you shrink its virtual disks from the VMware Tools control panel. You cannot shrink virtual disks if a snapshot exists. To remove the snapshot if one exists, choose VM > Snapshot > Snapshot Manager > Delete. See Unsupported and Disabled Partitions.

    In a Linux or FreeBSD guest operating system, to prepare virtual disks for shrinking, you should run VMware Tools as the root user. This way, you ensure the whole virtual disk is shrunk. Otherwise, if you shrink disks as a nonroot user you cannot wipe the parts of the virtual disk that require root-level permissions.

    To shrink a virtual disk:

    1. Launch the control panel.

    2. Click the Shrink tab.

    3. Select the virtual disks you want to shrink, then click Prepare to Shrink.

    A dialog box tracks the progress of the wiping process.

    Note: If you deselect some partitions, the whole disk is still shrunk. However, those partitions are not wiped for shrinking, and the shrink process does not reduce the size of the virtual disk as much as it could with all partitions selected.

    4. Click Yes when VMware Tools finishes wiping the selected disk partitions.

    A dialog box tracks the progress of the shrinking process. Shrinking disks may take considerable time.

    5. Click OK to finish.

    Unsupported and Disabled Partitions

    In some configurations, it is not possible to shrink virtual disks. If your virtual machine uses such a configuration, the Shrink tab displays information explaining why you cannot shrink your virtual disks.

    For example, you cannot shrink a virtual disk if

    Источник

    Добавить комментарий

    Ваш адрес email не будет опубликован. Обязательные поля помечены *

  • Русификатор undertale mac os
  • Русификатор photoshop mac os
  • Русификатор gta san andreas для mac os
  • Рукописные шрифты для mac os
  • Руководство пользователя mac os sierra