LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-20-2012, 04:26 PM   #1
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Rep: Reputation: Disabled
problem in unmounting and removing a volume group


Hi all, i'm new to linux and virtualization.

I'm trying to mount an image(fedora1.img)

mount -o loop fedora1.img /mnt/img/fedora1

but i got this error:

mount: wrong fs type, bad option, bad superblock on /dev/loop2,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

after that I tried(after googling):


Code:
#mount -t ext4 -o loop,ro,noload,offset=1048576 fedora1.img /mnt/img/fedora1
# fdisk -lu /etc/xen/fedora1.img

Disk /etc/xen/fedora1.img: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000697fc

               Device Boot      Start         End      Blocks   Id  System
/etc/xen/fedora1.img1   *        2048     1026047      512000   83  Linux
/etc/xen/fedora1.img2         1026048    41943039    20458496   8e  Linux LVM

# kpartx -av /etc/xen/fedora1.img

# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "vg1" using metadata type lvm2

#vgchange -ay vg1
  3 logical volume(s) in volume group "vg1" now active

# lvs
  LV   VG   Attr     LSize   Pool Origin Data%  Move Log Copy%  Convert
  lv1  vg1  -wi-ao--  39.06g                                           
  lv2  vg1  -wi-ao-- 858.53g                                           
  lv3  vg1  -wi-ao--  33.41g 

# mount /dev/vg1/lv1 /mnt/img/fedora1/
mount: special device /dev/vg1/lv1 does not exist
But there is no file in /dev/vg1
and this content of /mnt/img/fedora1:
config-3.3.4-5.fc17.i686 efi elf-memtest86+-4.20 grub grub2 initramfs-3.3.4-5.fc17.i686.img lost+found memtest86+-4.20 System.map-3.3.4-5.fc17.i686 vmlinuz-3.3.4-5.fc17.i686

and even mknod did not work:
# mknod -m 666 /dev/vg1/lv1 b 3 1
# mknod -m 666 /dev/vg1/lv2 b 3 1
# mknod -m 666 /dev/vg1/lv3 b 3 1

But again I got another error:

# mount /dev/vg1/lv1 /mnt/img/fedora1/
mount: /dev/vg1/lv1 is not a valid block device

So I'm trying to unmount and mount again:

umount /mnt/img
umount: /mnt/img: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))

when I was trying to deactivate vg1:

#vgchange -a n vg1
Can't deactivate volume group "vg1" with 3 open logical volume(s)

and

vgchange -a n vg1
Can't deactivate volume group "vg1" with 3 open logical volume(s)

and :

lvremove /dev/vg1/lv1
Logical volume vg1/lv1 contains a filesystem in use.


and:

Code:
#vgremove vg1
Do you really want to remove volume group "vg1" containing 3 logical volumes? [y/n]: y
Do you really want to remove active logical volume lv3? [y/n]: y
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  device-mapper: remove ioctl on  failed: Device or resource busy
  Unable to deactivate vg1-lv3 (253:0)
  Unable to deactivate logical volume "lv3


Now the question is how can I remove vg1?

and this is the result of:
Code:
# df -H
Filesystem                 Size  Used Avail Use% Mounted on
rootfs                      42G   21G   19G  53% /
devtmpfs                    17G     0   17G   0% /dev
tmpfs                       17G     0   17G   0% /dev/shm
tmpfs                       17G  124M   17G   1% /run
/dev/mapper/vg1-lv1         42G   21G   19G  53% /
tmpfs                       17G     0   17G   0% /sys/fs/cgroup
tmpfs                       17G     0   17G   0% /media
xenstore                    17G   82k   17G   1% /var/lib/xenstored
/dev/sda2                  521M  131M  365M  27% /boot
/dev/mapper/vg1-lv2        921G   14G  862G   2% /scratch
cs-nfs:/vol/home/grad1/    537G  204G  333G  38% /home/grad1
champ:/mnt/data5/scripts/  6.6T  3.7T  2.9T  56% /research/scripts
/dev/loop0                 921G   14G  862G   2% /mnt/img
/dev/mapper/vg1-lv1        921G   14G  862G   2% /mnt/img
/dev/mapper/vg1-lv2        921G   14G  862G   2% /mnt/img
/dev/loop1                 521M   61M  435M  13% /mnt/img/fedora1

Last edited by sanaz; 08-23-2012 at 10:45 AM.
 
Old 08-22-2012, 12:51 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
The fedora.img image file is an image of a hard drive, that contains two partitions.
Code:
Device                  Boot    Start           End       Blocks          Id      System
/etc/xen/fedora1.img1   *       2048            1026047   512000          83      Linux
/etc/xen/fedora1.img2           1026048         41943039  20458496        8e      Linux   LVM
Older partition tables had the first partition start on block 63. Newer partitions start on 2048, as is the case here.

The first partition is a 25 MB /boot partition. The second on contains the LVM. To attach the LVM to a loop device, you need to add the offset:
Code:
sudo losetup -fs /etc/xen/fedora1.img2 -o $((1026048*512))
Have you tried "kpartx -d" to remove the mappings you created?

Last edited by jschiwal; 08-22-2012 at 12:55 AM.
 
Old 08-22-2012, 03:24 PM   #3
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Original Poster
Rep: Reputation: Disabled
But I only have fedora.img not fedora.img1 and fedora.img2
 
Old 08-22-2012, 11:22 PM   #4
sKaar
Member
 
Registered: Jun 2006
Location: dartmouth, nova scotia
Distribution: slackware 12.1
Posts: 74

Rep: Reputation: 2
maybe use full path to the image?
 
Old 08-23-2012, 12:48 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
I'm saying that the image file you have contain's two partions. If you want to access the file system on either one, you need to use an offset to the beginning of partition in your losetup command. The kpartx command worked because it uses the partition table to locate the partitions inside the image.
 
Old 08-23-2012, 01:18 AM   #6
kedarp
Member
 
Registered: Jul 2012
Distribution: Ubuntu
Posts: 197
Blog Entries: 3

Rep: Reputation: 23
Post the o/p in "[code ] " and "[/code ]" tags. It make your post quite easy to read.

Last edited by kedarp; 08-23-2012 at 01:20 AM.
 
Old 08-27-2012, 12:49 PM   #7
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Original Poster
Rep: Reputation: Disabled
Dear jschiwal:

How can I do that?
 
Old 08-27-2012, 03:10 PM   #8
sKaar
Member
 
Registered: Jun 2006
Location: dartmouth, nova scotia
Distribution: slackware 12.1
Posts: 74

Rep: Reputation: 2
i'm guessing, knowing where the file table starts or something will allow the other tools to figure how to mount both. iow... you were told how, a few posts up.

Last edited by sKaar; 08-27-2012 at 03:17 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LVM Mount Physical Volume/Logical Volume without a working Volume Group mpivintis Linux - Newbie 10 01-11-2014 08:02 AM
[SOLVED] Redhat volume group,logical volume group dhairysheel Red Hat 3 08-02-2011 06:07 AM
[SOLVED] unmounting and remounting a volume rjo98 Linux - Newbie 7 03-09-2011 12:07 PM
problems removing lvm volume group shane601 Linux - Hardware 1 01-11-2009 02:20 AM
Fedora LVM volume group & Physical Volume resize problem gabeyg Fedora 1 05-14-2008 12:26 PM


All times are GMT -5. The time now is 07:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration