How to access an LVM2 Virtual Volume With Windows
However, getting to LVM2 while Windows is booted can be a problem. How can this be done in fail safe way?
I tried a number of methods, which I will discuss, but to get you to the information you want first, I will show the one thing that worked first. This method will consistently work even on something else, like a Mac or Solaris box, as well as with Windows 2k, XP and Vista. I have not tried it on earlier versions like Windows 98.
Some of the other methods worked with varying success until I upgraded to Windows Vista. This method is the only one I know that consistently works.
I apologise if this lens assumes a lot of technical knowledge - but to have reached the stage where you have an LVM2 volume and another OS I assume the reader will understand a certain amount of working with Linux.
Contents
- Why use LVM2?
- The method that worked - Virtual Box
- How it appears to Windows
- Obtain and install virtual Box
- Set Virtual box To Run As Administrator
- Choose and Download A Linux Distribution
- Finding the drive number in Windows Vista
- Make profile for raw disk access
- More Info on Windows/Linux environments
- Create the Virtual Machine
- Install Ubuntu Server JeOS
- Further information on LVM2
- Extend your LVM2 Partition
- Love This Lens?
- Bookmark This Lens
- What are your experiences with LVM?
- LVM2 and Linux Links
- Image Sources
- About Me
Why use LVM2?
A volume is in this context one logical partition - a single file system. Files are portable across the drives or physical partitions that make up the volume - a volume group.
When you need to take away a drive, provided you have sufficient space on the rest of the physical partitions in the volume, you can instruct LVM2 to ensure that the data is distributed so that no data remains on the volume to be removed. You do not manually have to move your files - and it is still considered one complete logical volume.
If you find that you use a lot of disk space quickly, LVM2 is a very good option to future proof yourself a bit.
The method that worked - Virtual Box
Virtual Box allows a user to set up a Virtual Machine - a simulated computer running as software. It uses hardware to accelerate where possible, but it is a sandbox, where the programs running in it are separated from your main operating system. Put simply - it allows you to run Linux within Windows, or Windows within Linux as well as multiple Windows instances and so on.
Virtual Box is also free for personal use.
This method involves in short putting Linux on a virtual box, mounting the drive on the Virtual Machine, mounting the LVM2 partition on Linux, using Samba to share the mounted partition. It means that you will be able to have full browsable read and write access to the drive. By using a minimal Linux installation, you will be able to keep the overhead down by a huge amount.
How it appears to Windows
The virtual machine will be running but it can be set up to run without a GUI, and as a service - so it will become transparent once fully configured. The interface through Windows is the tip of an iceberg. The busy Linux system now become the hidden depths of something that just works.
Obtain and install virtual Box
Download Virtual Box.
Run the downloaded file to install it. On Vista you will need to give it permission to install. You can choose to use VMware or colinux for this, but the procedures will be different and your mileage with raw disk access may vary on them. I chose Virtual Box as this has worked every time for me.
Set Virtual box To Run As Administrator
Raw disk access requires admin priviledges
Bring up the properties dialog on the shortcut you will use to start it. I chose to do both the start menu one and the desktop one so Launchy can be used. Select the "Shortcut" tab and click the "Advanced" button highlighted.
Choose and Download A Linux Distribution
I used the Ubuntu server edition as this comes with options to install a very basic setup and with simple access to Samba file sharing. For the remainder of this tutorial I will guide as if using the Ubuntu Server JeOS installation. Adapt this to your choice of distro if you use another.
Download Ubuntu Server.
Finding the drive number in Windows Vista
You will need this to create write though access to the drive
First bring up the control panel. In the Windows Vista Control Panel, select System and Maintenance (highlighted in red).
Make profile for raw disk access
If you want to find out more on this, I suggest reading section 9.9 of the Virtual Box user manual. Here are the steps outlined:
- Consider the path you want to create a virtual disk at - For now I suggest c:\users\<username>\rawdisk.vdmk. You can move it once you have done this.
- Click start, run then type "cmd" and hit enter.
- Type "cd c:\program files\Sun\xVM VirtualBox\" so you are in the Virtual Box program directory.
- For the required disk or partition (changing paths as necessary):
VBoxManage internalcommands createrawvmdk -filename c:\users\<username>\rawdisk.vdmk -rawdisk \\.\PhysicalDrive0 -register
That last command line explained:
- internalcommands selects a lower level command set in VboxManage
- createrawvmdk instructs it to create a VMDK for raw drive access
- -filename specifies the output filename for the VMDK
- -rawdisk specifies the drive number. Note the notation here - the correct drive number, obtained from the previous step should be used here.
- -register ensures that the newly created drive is registered (via the registry) with Vbox and will show up in the virtual box media manager - which will save you plenty a little fiddling and trouble later.
More Info on Windows/Linux environments
Create the Virtual Machine
Start Virtual Box. Click "New" to create a new virtual machine. The wizard will start.
Click next (the first screen is a bit useless). Give your virtual machine a name - for now "lvmaccess" will do.
Now, in the "Operating system" drop down, select "Linux". Current versions of Virtual Box will then automatically select "Ubuntu" in the Version box. Click Next.
For the base memory size, since you are not doing anything requiring much memory, the default of 384mb is fine. Click "next".
You then need a hard disk image to install to. Click "New.." and you will see the "Create new virtual disk wizard". Click Next. As you will not need much on this, select "Dynamically Expanding Storage" which should give it the smallest profile. Click Next. In the location box the name of your VM should be there. Select 1Gb for the size - it will not actually use this much. Click Finish to complete tha, and you will returned to the "Create new virtual machine" dialog.
Click next, and finish.
Now in the Virtual Box window, your new VM should appear on the left hand column. Select it and click settings. In this dialog, select Hard Disks, which should be the second option from the left hand list.
Add your raw disk access profile by clicking the "+" disk icon on the top right. You will be asked to create or select a disk. Hit "select" and you will see the virtual media manager.
You now need to add the raw disk profile to the virtual media manager. Press the "Add" button here, and you will see a file selector. Select the file you created in step three and click "Open". In the virtual media manager, ensure that this is in the list of hard disks, then select it and click "Select" on the bottom.
You will be returned to the settings page. You should now add the installation CD. Click on the "CD/DVD-ROM" icon on the left. Tick "Mount CD/DVD Drive", and ensure that "ISO Image file" is selected. Use the file selector to choose the Linux Administration ISO you downloaded in step Two.
For the networking - I recommend using a host-only network.
Close the settings Window.
Install Ubuntu Server JeOS
Press F4 for more options and select JeOS or Virtual Machine. Press enter to continue the install.
You will be asked to select a language, username, password and machine name.
Eventually the installation will ask you to select the roles. Only select "SMB Server" or "SAMBA Server". Hit ok, and complete the installation.
Once you have done this, boot into the installation. Login with the user name you chose before.
Now install lvm2 with "sudo apt-get install lvm2". You will be asked for a password, and if you really want to install, press y for yes.
You should then reboot the linux installation and your lvm2 set should be in /dev/mapper. Add this to your fstab so the volume is mounted somewhere - perhaps mount it in /mnt/lvm_volume .
Now then create an SMB share for it by editing /etc/samba/smb.conf - "sudo nano /etc/samba/smb.conf". Find the line that says "#=== Share Definitions ===".
Add the following:
[target_drive]
comment = LVM Volume
path = /mnt/lvm_volume
browseable = yes
read only = no
guest ok = yes
create mask = 0775
directory mask = 0775
Now restart the SMB service. You should now be able open your LVM2 device in Windows Vista via the SMB share.
Although the method is complicated - with a cut down JeOS installation, it is kept fairly minimal. It would be even better if someone was to use Puppy Linux or another tiny distro to create a VM appliance to facilitate this - perhaps I will in the future.
Further information on LVM2
LVM is a logical volume manager for the Linux kernel; it manages disk drives and similar mass-storage devices, in particular large ones. The term "volume" refers to a disk drive or partition thereof. It was originally written in 1998 by Heinz Mauelshagen, who based its design on that of the LVM in HP-UX.
The abbreviation "LVM" can also refer to the Logical Volume Management available in HP-UX, IBM AIX and OS/2 operating systems.
The installers for the Arch Linux, Debian, Fedora, Gentoo, MontaVista Linux, openSUSE, SLED, Slackware, SLES, and Ubuntu distributions are LVM-aware and can install a bootable system with a root filesystem on a logical volume.
Extend your LVM2 Partition
Why not take advantage of the power of this system by extending your drive space? With an LVM2 partition, you do not need to manually copy files to the new driven and you can keep the old drive so you end up with a much larger net volume size.
Fetching new data from eBay now... please stand byLove This Lens?
Bookmark This Lens
What are your experiences with LVM?
Have you tried to access LVM2 partitions?
Is there anything you think I should change/add in this lens?
Feel free to let me know what you think.
If you have links, add them in the links module after the guestbook...
LVM2 and Linux Links
There are plenty of other places talking about this - although they use different methods, however, the above was the only one I found to consistently succeed. Vote for or add yours.
Irrelevant or spam links will be removed. Feel free to promote genuine blogs or lenses.
How-To: Install Ubuntu on LVM partitions. | Debian/Ubuntu Tips & Tricks
LVM (Logical Volume Manager) is a great piece of s more...0 points
Replace a LVM2 drive with a larger one
Replace a LVM2 drive with a larger one. My MythTV more...0 points
Red Hat Knowledgebase: What is the procedure to increase the size of an LVM2 logical volume and its filesystem?
It is recommended that a resizing procedure be tes more...0 points
coderchris.com» How to Mount a Linux LVM2 Partition in Windows
I have a dual boot Windows Vista / Linux Laptop an more...0 points
Image Sources
Step by step screenshots are of Windows Vista taken with the Gimp.
Further images are from AllPosters.
Hey Webmasters! - Add hundreds of thousands of images to your site - Free!
Join the AllPosters.com Affiliates Program and get access to hundred of thousands of images for your site. AllPosters.com has images from popular movies, music groups, sports teams, fine art, and much more. Adding these images to your site will enhance your content.
Furthermore, you get paid for improving your site with poster/print images! All of the images you use will link to AllPosters.com where your site visitors can make purchases. When they buy something, AllPosters.com pays you 20% of the sale. If the visitor decides to purchase within 10 days of their last visit from your website, you'll still earn commission on the sale! It's easy to sign-up, build links, and track your sales.
Sign up today!
About Me
Lensmaster dannystaple has been a member since July 5 2008, has rated 415 lenses, favorited 128, and has created 37 lenses from scratch. This member's top-ranked page is "HOWTO: Fix Broken Christmas Lights Quickly". See all my lenses
My Bio
I build stuff, grow stuff, read stuff and like to write about it. I like to philosophise, research and learn, and then go the next step and apply, do and build. I love reading How-to's and will experiment with things to see what else I can learn. Read more about me and my lenses here.

KudoSurf Me!
Check out these great lenses...
-
- HOWTO: Fix Broken Christmas Lights Quickly
Broken fairy lights are frustrating and it can take hours to fix them. This year, when about to put up the Christmas lights, I spotted that one set would not turn on and had a brainwave for fixing them. Have a look below for a poor chap faced with t... view lens -
- HOWTO: Transport Your Tools with PortableApps
Being able to take your browser, music player or other software and its configuration with you when you go to other places with computers will save you time and frustration setting up and personalising. At home, you probably have your browser (and o... view lens -
- How to make a propagator to start your seeds
A seed propagator can give seeds a really good strong start and allow you to grow them out of season. Using one will speed up germination and increase germination success. Full step-by-step illustrated instructions for building your own propagator... view lens -
- Windows XP, Vista, Linux and Ubuntu computer PC software hardware tips
I have written a few pages with tips on computers. I have worked with computers for many years, so many that it would be silly for me to deny being a complete computer geek. However, although I am geeky, I try to explain things in simple terms so an... view lens -
- Danny Staple's Bio
First and foremost, I am now a very proud father to be, which means my life is undergoing all kinds of changes and priority shifts right now. Far from squidoo going out, getting into writing on squidoo was one of those shifts, as it is far less space... view lens



