Technology, Social Media, Travel
RSS icon Email icon Home icon
  • How to Mount a VMWare (Linux) Partition in Ubuntu (Hardy 8.04)

    Posted on August 22nd, 2008 John Berns No comments

    I recently had a problem starting a VMWare VM (the VM ran CentOS) and I needed to get some data off the virtual machine. Since the VM would no longer boot, I decided to try to mount the partition under Linux and copy the data off. It was a little trickier than I had anticpated so I tought I would share my solution.

    vmware-mount.pl Doesn’t Get You All The Way There

    vmware-mount.pl does just what is says it will do: it mounts VMWare partitions on your computer, IF the target computer can mount the partition type. The problem with Ubuntu (Hardy 8.04) was that it would not mount an LVM partition.

    Look at vmware-mount.pl for moreon how to use this command.

    But vmware-mount.pl was still useful in helping me find out the partition type and creating a block device from the .vmdk file that I could use other tools to mount.

    Change to the directory where you have the virtual machine files. There will be one (often more) .vmdk files in that directory and these files are the virtual drives that hold the data for your VM.

    cd /path/to/your/vm/

    Now let’s see what is inside these files; we want to know what partitions there are so we can figure out which one has the data we are searching for.

    sudo vmware-mount.pl -p name-of-the-vmware-virtual-drive.vmdk

    That will output something like:


    --------------------------------------------
    VMware for Linux - Virtual Hard Disk Mounter
    Version: 1.0 build-80004
    Copyright 1998 VMware, Inc. All rights reserved. -- VMware Confidential
    --------------------------------------------

    Nr Start Size Type Id Sytem
    -- ---------- ---------- ---- -- ------------------------
    1 63 208782 BIOS 83 Linux
    2 208845 16563015 BIOS 8E Unknown

    So we have two partitions in this vmware virtual drive. Just by looking at it I can tell that the big partition, partition number 2 is the one that has all my data. But notice the “Id” is “8E” and the “Sytem” is “Unknown.” Well “8E” is the ID for LVM file systems and that’s a problem; let’s try and mount it and see what happens:

    Create a mount point:

    sudo mkdir /mnt/vmdk

    Now let’s try to mount it.

    The command syntax for mounting a .vmdk partition is

    sudo vmware-mount.pl name-of-the-vmware-virtual-drive.vmdk [partition number] /mnt/point

    So if we want to mount partition 2 on /mnt/vmdk we’ll try:

    sudo vmware-mount.pl name-of-the-vmware-virtual-drive.vmdk 2 /mnt/vmdk

    And the results we get are something like this:


    jb@jb-ubuntu:~/Desktop/fuxored-disk$ sudo vmware-mount.pl CentOS\ 4.4-000007-cl1.vmdk 2 /mnt/cent
    [sudo] password for jb:

    ——————————————–
    VMware for Linux - Virtual Hard Disk Mounter
    Version: 1.0 build-80004
    Copyright 1998 VMware, Inc. All rights reserved. — VMware Confidential
    ——————————————–

    It has been reported that this program does not work correctly with 2.4+ Linux
    kernels in some cases, and you are currently running such a kernel. Do you
    really want to continue? [N] y

    No Network Block Device detected.

    There is no Network Block Device defined on this machine. This script is about
    to create the /dev/nb0 Network Block Device. Continue? [Y]

    Creating the /dev/nb0 Network Block Device

    No Network Block Device driver detected.

    Trying to load the Network Block Device driver kernel module… Success.

    Client: The partition is now mapped on the /dev/nb0 Network Block Device.
    mount: unknown filesystem type ‘LVM2_member’

    If you know the filesystem of the partition you want to mount, you can provide
    it using the -t command line option. Since you haven’t done so, this script is
    going to try to determine the filesystem of the partition based on the partition
    type and id.

    Unable to retrieve the filesystem of the partition (the partition type is BIOS
    and the partition Id is 8E). Please file an incident with VMware at
    http://www.vmware.com/forms/Incident_Login.cfm by copying this error message.
    jb@jb-ubuntu:~/Desktop/fuxored-disk$

    It created a block device that can be read, but the partition didn’t mount as we can see by this message:


    Client: The partition is now mapped on the /dev/nb0 Network Block Device.
    mount: unknown filesystem type 'LVM2_member'

    So we have a block device of type “LVM2_member.” Let’s try to find a way to mount that!

    Luckily, Kurt Wall did a nice tutorial to how to mount a fedora logical volume in Ubuntu that solves our problem.

    If you type in the commands he has listed on that page, one after the other, you will have a mounted partition and problem solved!

    Share and Enjoy:
    • Digg
    • Reddit
    • StumbleUpon
    • del.icio.us
    • Facebook
    • Google
    • TwitThis
    • Pownce
    • Slashdot
    • Live
    • Furl
    • NewsVine
    • Spurl
    • YahooMyWeb
    • Sphinn
    • SphereIt
    • Technorati
    • e-mail
    • Identi.ca

    Leave a reply