Notepad:Local Mount

From Amar
Jump to navigationJump to search
lomount -t <type> -diskimage </dev/> -partition <num> /mnt/point

Simple partition

More details on local mount of disk

  • Determine what loopbacks are currently being used

To determine all the loops type

   ls /dev/loop*

Determine which loops have been assigned

   losetup -a

Pick a loop device which has not been assigned Open the disk image using loopback devices; replace values as appropriate

   losetup /dev/loop5 disk0

Determine what the partitions are

   fdisk -l /dev/loop5


LVM partition

Found in comments First make sure your guest isn't running unless you want to trash its file systems.

losetup -f /var/lib/xen/images/foo.img
losetup -a
# Make a note of which device corresponds to /var/lib/images/foo.img,
# 'll call it /dev/loopN but it's probably /dev/loop0
kpartx -va /dev/loopN

You'll get two new entries in /dev/mapper now: /dev/mapper/loopNp1 and /dev/mapper/loopNp2. loopNp1 is /boot (asume you have got a standard layout). loopNp2 is a volume group. You can just mount /dev/loopNp1 to poke around the /boot file system.

Now

vgscan

This is where you might come unstuck. The default volume group for Red Hat and similar is "VolGroup00". If your dom0 is using LVM and so is the guest then you'll have do VolGroup00's and that's bad. The best thing to do now is to boot a rescue image in a different domU and rename the guest's volume group. You'll need to undo the kpartx and losetup (see below first) and when you've all finished then you'll need to either fix up the guest's /boot/initrd*.img, /etc/fstab and /boot/grub/grub.conf to hold the new name or you'll have to rename it back again in the rescue guest.

Anyway, assuming you don't get a clash:

vgchange -ay VolGroup00

The guest's file systems are now in /dev/VolGroup00 and you can mount them as normal.

To undo everything:

1. umount any file systyems you mounted
2. vgchange -an VolGroup00
3. kpartx -d /dev/loopN
4. losetup -d /dev/loopN 



← Back to Notepad



<insert>googlesearchwiki</insert> <insert>paypal</insert> <insert>analytics</insert>