[ale] Loopback mounting of disk images with LVM

Michael B. Trausch mbt at zest.trausch.us
Mon Sep 21 00:31:28 EDT 2009


On Fri, 2009-09-18 at 17:01 -0400, brian at polibyte.com wrote:
> $ losetup /dev/loop0 /mnt/vm1/flat -o 115153920
> 
> # However, when I run pvscan or vgscan loop0 isn't recognized.
> 
> #device/dev-io.c:486         Opened /dev/loop0 RO
> #device/dev-io.c:260       /dev/loop0: size is 66883954 sectors
> #device/dev-io.c:532         Closed /dev/loop0
> #device/dev-io.c:260       /dev/loop0: size is 66883954 sectors
> #device/dev-io.c:486         Opened /dev/loop0 RW O_DIRECT
> #device/dev-io.c:134         /dev/loop0: block size is 1024 bytes
> #device/dev-io.c:532         Closed /dev/loop0
> #filters/filter-composite.c:31         Using /dev/loop0
> #device/dev-io.c:486         Opened /dev/loop0 RW O_DIRECT
> #device/dev-io.c:134         /dev/loop0: block size is 1024 bytes
> #label/label.c:184       /dev/loop0: No label detected
> #device/dev-io.c:532         Closed /dev/loop0 

Have you tried running "partprobe", so as to create /dev/loop0p0
and /dev/loop0p1?

It at least works when you have a LVM that contains a partition map; I
have a logical volume that houses a Windows XP installation that I boot
up once a year for tax work; if I do 'partprobe' I get partitions for
it:

mbt at zest:~$ ls -l /dev/mapper
total 0
crw-rw---- 1 root root  10, 60 2009-09-19 11:43 control
brw-rw---- 1 root disk 252,  1 2009-09-19 11:43 zestvg-karmic.20090820
brw-rw---- 1 root disk 252,  0 2009-09-19 11:43 zestvg-old--home--backup
brw-rw---- 1 root disk 252,  6 2009-09-19 11:43 zestvg-shared.home
brw-rw---- 1 root disk 252,  3 2009-09-19 11:43 zestvg-shared.mail
brw-rw---- 1 root disk 252,  5 2009-09-19 11:43 zestvg-shared.swap
brw-rw---- 1 root disk 252,  2 2009-09-19 11:43 zestvg-shared.tmp
brw-rw---- 1 root disk 252,  7 2009-09-19 11:43 zestvg-tunics
brw-rw---- 1 root disk 252,  4 2009-09-19 11:43 zestvg-vm.winxp
brw-rw---- 1 root disk 252,  8 2009-09-21 00:29 zestvg-vm.winxpp1

Note that the p1 doesn't show up until I run partprobe; that is, it is
not created at system boot or when the VG is brought online.  Similar
things may happen for loopback devices; I'm not certain of that.  It's
worth a try, anyway.  At the very least, you might be able to make the
image file show up in device-mapper, and then it should definitely work.

	--- Mike

-- 
Blog:  http://mike.trausch.us/blog/
Misc. Software:  http://mike.trausch.us/software/

“The greater danger for most of us lies not in setting our aim too
high and falling short; but in setting our aim too low, and achieving
our mark.” —Michelangelo



More information about the Ale mailing list