LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   need help with lvremove :( (http://www.linuxquestions.org/questions/linux-newbie-8/need-help-with-lvremove-4175420183/)

tahaz 08-03-2012 09:54 AM

need help with lvremove :(
 
need help with lvremove, im using fedora 17
/dev/vg_bindas/lv4 is mounted on /usr/local
also lvremove with -f option didnt work either


Code:

[root@bindas vg_bindas]# ps -ef | grep usr/local
root    28145 24284  0 08:50 pts/1    00:00:00 grep --color=auto usr/local
[root@bindas vg_bindas]# ps auxxx  | grep usr/local
root    28152  0.0  0.0 109400  828 pts/1    S+  08:50  0:00 grep --color=auto usr/local
[root@bindas vg_bindas]# umount /usr/local
umount: /usr/local: not mounted
[root@bindas vg_bindas]# lvremove /dev/vg_bindas/lv4
  Logical volume vg_bindas/lv4 contains a filesystem in use.
[root@bindas vg_bindas]# lsof | grep usr/local
[root@bindas vg_bindas]#


MensaWater 08-03-2012 10:33 AM

ps won't show you mounted filesystems.

Use "df -h" to see what is mounted and where it is mounted. Run your umount against the filesystem mount name associated with lv4.

Be sure that whatever is in the filesystem is something you no longer need before you do the lvremove.

If you need further help post your df -h output here.

tahaz 08-03-2012 04:43 PM

thanks for reply but it didnt work

i posted ps to show that /usr/local is not being used in any process preventing lvremove
I need to do this because i need more space in root (/) as most installs go to /usr not /usr/local
i am new to linux so didnt know which filesystem to provide extra space there, i gave / only 5 gb and /usr/local 15 gb
some softwares tend to go /opt but not all
i even tried shrinking the filesystem by resize2fs but still got errors

Code:

[root@bindas opt]# df -h
Filesystem                Size  Used Avail Use% Mounted on
rootfs                    4.9G  3.2G  1.7G  66% /
devtmpfs                  3.9G    0  3.9G  0% /dev
tmpfs                      3.9G  104K  3.9G  1% /dev/shm
tmpfs                      3.9G  2.1M  3.9G  1% /run
/dev/mapper/vg_bindas-lv1  4.9G  3.2G  1.7G  66% /
tmpfs                      3.9G    0  3.9G  0% /sys/fs/cgroup
tmpfs                      3.9G    0  3.9G  0% /media
/dev/mapper/vg_bindas-lv2  4.8G  517M  4.1G  12% /home
/dev/mapper/vg_bindas-lv5  18G 1013M  16G  7% /opt
/dev/mapper/vg_bindas-lv3  4.8G  590M  4.0G  13% /var
/dev/sda7                  482M  94M  364M  21% /boot
/dev/sda3                  404G  187G  218G  47% /winC
/dev/mapper/vg_bindas-lv4  15G  129M  14G  1% /usr/local
[root@bindas opt]# umount /usr/local
[root@bindas opt]# df -h
Filesystem                Size  Used Avail Use% Mounted on
rootfs                    4.9G  3.2G  1.7G  66% /
devtmpfs                  3.9G    0  3.9G  0% /dev
tmpfs                      3.9G  104K  3.9G  1% /dev/shm
tmpfs                      3.9G  2.1M  3.9G  1% /run
/dev/mapper/vg_bindas-lv1  4.9G  3.2G  1.7G  66% /
tmpfs                      3.9G    0  3.9G  0% /sys/fs/cgroup
tmpfs                      3.9G    0  3.9G  0% /media
/dev/mapper/vg_bindas-lv2  4.8G  517M  4.1G  12% /home
/dev/mapper/vg_bindas-lv5  18G 1013M  16G  7% /opt
/dev/mapper/vg_bindas-lv3  4.8G  590M  4.0G  13% /var
/dev/sda7                  482M  94M  364M  21% /boot
/dev/sda3                  404G  187G  218G  47% /winC
[root@bindas opt]# lvremove /dev/vg_bindas/lv4
  Logical volume vg_bindas/lv4 contains a filesystem in use.
[root@bindas opt]# lvremove -f /dev/vg_bindas/lv4
  Logical volume vg_bindas/lv4 contains a filesystem in use.
[root@bindas opt]#


MensaWater 08-03-2012 05:15 PM

Run "lsof /usr/local". It will show you any process that is using the directory, /usr/local.

The ps command would only show you process NAMES that include /usr/local. Just because a process is running in /usr/local it isn't necessary part of the process name.

You can however run "ps -ef |grep <PID>" for any process ID shown by the lsof of /usr/local.

You didn't get any errors when you tried the umount? That seems odd if it is actually busy as the lvremove says. However sometimes a filesystem is busy for simple reasons. (e.g. if you happen to have done a "cd /usr/local" then ran "su -" to become root - the user you switched from is still busying out /usr/local even though the user you switched to isn't there - this is because the su is starting a subshell.)

Also you should do "ls -l /dev/mapper/vg_bindas-lv4" and "/dev/vg_bindas/lv4" so you can see what (if any symbolic links are shown). One should be a symbolic link to the other but there's always a chance things aren't as expected so it is always best to verify assumptions even if they are "usually" the correct ones.

tahaz 08-03-2012 05:30 PM

thanks for the info on lsof
no i didnt get any errors when doing a umount, this time i made sure i was not in /usr/local when doing su -
either any process are using /usr/local because then i would have gotten errors

here ls -l on those paths

Code:

[root@bindas ~]# lsof /usr/local
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /run/user/taha/gvfs
      Output information may be incomplete.
[root@bindas ~]# ls -l /dev/mapper/vg_bindas-lv4
lrwxrwxrwx. 1 root root 7 Aug  3 08:19 /dev/mapper/vg_bindas-lv4 -> ../dm-3
[root@bindas ~]# ls -l /dev/vg_bindas/lv4
lrwxrwxrwx. 1 root root 7 Aug  3 08:19 /dev/vg_bindas/lv4 -> ../dm-3
[root@bindas ~]# df -h
Filesystem                Size  Used Avail Use% Mounted on
rootfs                    4.9G  3.2G  1.7G  66% /
devtmpfs                  3.9G    0  3.9G  0% /dev
tmpfs                      3.9G  296K  3.9G  1% /dev/shm
tmpfs                      3.9G  2.3M  3.9G  1% /run
/dev/mapper/vg_bindas-lv1  4.9G  3.2G  1.7G  66% /
tmpfs                      3.9G    0  3.9G  0% /sys/fs/cgroup
tmpfs                      3.9G    0  3.9G  0% /media
/dev/mapper/vg_bindas-lv2  4.8G  529M  4.1G  12% /home
/dev/mapper/vg_bindas-lv5  18G  1.1G  16G  7% /opt
/dev/mapper/vg_bindas-lv3  4.8G  600M  4.0G  13% /var
/dev/sda7                  482M  94M  364M  21% /boot
/dev/sda3                  404G  187G  218G  47% /winC
[root@bindas ~]# lvremove /dev/mapper/vg_bindas-lv4
  Logical volume vg_bindas/lv4 contains a filesystem in use.
[root@bindas ~]#


deadeyes 08-04-2012 05:42 PM

Note that it is possible you dont see any in use files however it might still be in use.
NFS shows such behavior so make sure this filesystem is not exported or stop nfs service.

Also if /usr/local is not mounted, how did you unmount it? Umount /usr/local? Or umount -l /usr/local?
Note that the latter can result in such behavior that it is still in use/seems to be still in use to the kernel.

What is in /proc/mounts?
I have seen issues with /etc/mtab being incorrect while /proc/mounts shows the correct mounts.

What is your final goal?
You might have to reboot to solve this issue.

MensaWater 08-06-2012 10:06 AM

The message from lsof is informative:
Quote:

WARNING: can't stat() fuse.gvfs-fuse-daemon file system /run/user/taha/gvfs
gvfs is a Gnome Virtual Filesystem used for sharing (as NFS mentioned in previous post is a shared filesystem). Is this filesystem local to the system on which you're doing the umount? Is it shared out from this system to another one? You may need to unmount it from another system.

Also it begs the question whether your other filesystems are gvfs and if so what is the proper method for expanding them if they're also shared out?

Unfortunately I don't use gvfs here so can't give you much guidance. You should do a web search for "unmount gvfs" or "umount gvfs".


All times are GMT -5. The time now is 11:03 AM.