1751742 Members
5758 Online
108781 Solutions
New Discussion юеВ

Re: unmount LVM volume

 
SOLVED
Go to solution
msaygak
Frequent Advisor

unmount LVM volume

Hello!
I've created logical volume vgname/lvol1 with control file /dev/vgname/group. After that I've formated logical volume into vxfs an then I've mounted logical volume into /dev/vgname/
So now I cannot unmount this logical volume because there is no /dev/vgname/group, /dev/vgname/lvol1. An I can not vgexport this volume group because it's in use :(
Is there any way to unmount this logical volume?
10 REPLIES 10
R.K. #
Honored Contributor

Re: unmount LVM volume

Hi..

What is the output of umount command?
# umount /mount_pt

Does it say busy?
Don't fix what ain't broke
msaygak
Frequent Advisor

Re: unmount LVM volume

umount: cannot unmount /dev/vgname/lvol1 : No such file or directory
umount: return error 1.


rariasn
Honored Contributor

Re: unmount LVM volume

Hi,

# vchange -a n /dev/vgname

# mount /dev/vgname/lvol1 /dev/vgname/directory_name

# vgexport -p vgname /tmp/vgname.map

Rgs,

R.K. #
Honored Contributor

Re: unmount LVM volume

#bdf /dev/vgname/lvol1

Try to unmount the mount point, not lvol.
# umount

# ll /dev/*/group | grep -i vgname
# ll /dev/vgname/* | grep -i lvol1
Don't fix what ain't broke
msaygak
Frequent Advisor

Re: unmount LVM volume

Since I mounted /dev/vgname/lvol1 into /dev/vgname there is no files /dev/vgname/group and /dev/vgname/[r]lvol1

to rariasn:
So, vgchange -a n vgname returns:
vgchange: "/dev/vgname/group": not a character device.

to R.K. #:
umount can not unmount neither /dev/vgname no /dev/vgname/lvol1. In both cases it returns the same error message:
umount: cannot unmount /dev/vgname/lvol1 : No such file or directory
umount: return error 1.

msaygak
Frequent Advisor

Re: unmount LVM volume

for me it's like "unzip.zip" :)
rariasn
Honored Contributor

Re: unmount LVM volume

Hi,

Sample bad mount option:

# cd /
# vgchange -a y vgexport
# mount /dev/vgexport /tmp/export
# ll /tmp/export

total 0
crw------- 1 root sys 64 0x080000 Apr 22 2008 group
brw------- 1 root sys 64 0x080001 Apr 22 2008 lvexport
crw------- 1 root root 64 0x080001 Apr 22 2008 rlvexport

Next,

# cd /
# umount /tmp/export
# mount /dev/vgexport/lvexport /tmp/export
# bdf /tmp/export
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 204800 76781 120093 39% /
.

No FS mounted

# cd /
# umount /tmp/export
# mount /dev/vgexport/lvexport /tmp/export
# ll /tmp/export

total 146144
drwxr-xr-x 2 root sys 8192 Aug 17 2007 CobolServerExpress50
drwx------ 4 root sys 8192 Apr 2 2009 CobolServerExpress51SP
2
drwxrwxrwx 2 root sys 96 Oct 8 09:05 CobolServerExpress51SP
3
drwxrwx--- 9 oracle dba 8192 Nov 11 10:15 Oracle
...

#bdf /tmp/export
Filesystem kbytes used avail %used Mounted on
/dev/vgexport/lvexport
264929280 63756848 199605296 24% /tmp/export

# vgexport -p -m /tmp/export.map vgexport


rgs,



rgs,


msaygak
Frequent Advisor

Re: unmount LVM volume

logical volume mounted into /DEV/VGNAME
new file system replaced content of the /dev/vgname. This is the trouble.
Matti_Kurkela
Honored Contributor
Solution

Re: unmount LVM volume

Can you find out the minor device numbers of /dev/vgname/group and/or /dev/vgname/lvol1, e.g. from your notes, old backups or something?

The minor device number for the /dev/vgname/group file should be 0xNN0000, where NN is the unknown part. For the /dev/vgname/[r]lvol1, it should be 0xNN0001 if you did not specify custom LV names.

If you can find out the correct minor numbers, just recreate the device files with mknod:

mknod /dev/vgname/group c 64 0xNN0000
mknod /dev/vgname/lvol1 b 64 0xNN0001
mknod /dev/vgname/rlvol1 c 64 0xNN0001

These device files will be created to the root directory of your troublesome filesystem, so remember to remove them after you've cleaned up this mess.

Now try unmounting the filesystem:
umount /dev/vgname/lvol1

The "fake" device node we created will satisfy the requirements while the filesystem is still there, and after the filesystem unmounts, the real device node will be visible again. As long as the "fake" and the real device node use the same device types and major & minor device numbers, the "fake" device node should even work exactly the same as the real one.

If this trick fails, you can always just ensure that the filesystem will not be auto-mounted at system boot by removing it from /etc/fstab, and then reboot the system.

You can then mount it manually to some other location:
mkdir /mnt
mount /dev/vgname/group /mnt

Then clean up the fake devices, which will now be at /mnt/:
rm /mnt/group /mnt/lvol1 /mnt/rlvol1

I hope you've now learned your lesson of not mounting your filesystems under /dev :)

MK
MK