Sample script to mount lvm volumes

Sample script to mount lvm volumes

I have attached two simple scripts to show how you can use vmware-mount on Linux to open LVM volumes.

lvmMount.sh is a barebones script to mount lvm disks. Basic idea is simple, vmware-mount on Linux allows you to mount a VMDK in flat mode. Using this, we mount all the disks in an LVM physical group in flat mode. We can then use LVM to scan for volume groups, activate the volume group of interest and mount the volume.

lvmCreate.sh is another barebones script to test the lvmMount.sh. It creates 2 disks, makes a group out of these, creates a volume, mounts it and copies a test file into the volume.

I have hardcoded many parameters and removed any error checking to show the sequence of commands. I don't claim to be a Linux/Scripting expert, please feel free to comment.

Attachments
Comments

Sudarsan,

I've tried the method in the shell examples and have a question as it related to doing this using the VDDK API's flat file. e.g. VixDiskLib_Open() & VIXDISKLIB_FLAG_OPEN_READ_ONLY flag.

Can the VG name be modified if the flat file was opened this way. I'm getting the following errors...

# vgrename YafuWk-3orv-WuXR-0Kf9-HuLk-1uRA-Ip6xNe vmwarelvm

/dev/loop0: write failed after 0 of 1536 at 4608: Input/output error

Thanks for the comment, red0mark.

http://communities.vmware.com/message/1273439#1273439 is also discussing this.

-Sudarsan

Version history
Revision #:
1 of 1
Last update:
‎02-05-2009 11:51 AM
Updated by: