Operating System - HP-UX
1833124 Members
3007 Online
110051 Solutions
New Discussion

reducing lv that is mounted to /home

 
SOLVED
Go to solution
Olga_1
Regular Advisor

reducing lv that is mounted to /home

do I have to boot into single user mode in order to reduce:
/dev/vg06/lv_u17 10240000 1091390 8862750 11% /home

It would not let me do:

umount /dev/vg06/lv_u17
umount: cannot unmount /home : Device busy

fuser /home does not show anything.

Thank you for any comments.
10 REPLIES 10
Pete Randall
Outstanding Contributor

Re: reducing lv that is mounted to /home

Olga,

Yes, single user mode would be the easiest way to get /home unmounted.

Pete

Pete
harry d brown jr
Honored Contributor

Re: reducing lv that is mounted to /home

Olga,

using lvreduce is VERY VERY dangerous and MOSTLY likely WILL lead to loss of data. IT WILL NOT just return unused EXTENT's.

You are better off, backing it up, then deleting the LV, then recreating it to the correct size, then restoring the data!


live free or die
harry
Live Free or Die
Sanjay_6
Honored Contributor

Re: reducing lv that is mounted to /home

Hi Olga,

You should not have to take the system to single user mode to reduce /home. Check the users / processes using /home,

fuser -cu /home

To kill all the processes accessing /home, do this,

fuser -ck /home

Or ask the users using home to logout and kill the processes accessing /home. Take a backup of /home, unmount the filesystem, remove it and then add the filesystem with a smaller size, mount it again for the users to access it.

Hope this helps.

Regds
Helen French
Honored Contributor

Re: reducing lv that is mounted to /home

Hi Olga:

Yes, booting in single user mode will be the best bet for you. If possible, I would suggest you to recreate the LV. I would do the following too:

1) Backup /home
2) umount /home
3) Delete LV
4) Create LV with new size
5) mount /home
6) Restore from backup.

If you want to lvreduce it, then check the usage of fsadm too.

HTH,
Shiju
Life is a promise, fulfill it!
Olga_1
Regular Advisor

Re: reducing lv that is mounted to /home

1. I did backed up the data;

2. I tried to do the following:

fuser -ku -c /home and it logged me out.

The thing is, I was logged in remotely to the system with my own user id and after su - root

May be that was the reason I could not umount /home?
Can I do it remotely? Should I be logged in as root, without my user loggin? If this is the case, please tell me how to enable remote root login?

Thank you.
James R. Ferguson
Acclaimed Contributor

Re: reducing lv that is mounted to /home

Hi:

A common mistake encountered when trying to unmount a filesystem is to be 'cd'-ed into it. Use the suggested 'fuser -ku /home' to list and kill processes associated with that filesystem.

Unless you have Online JFS, you will not be able to shrink your filesystem without a backup of it to restore it. In the absence of Online JFS, you will need to 'lvreduce' the logical volume size and then 'newfs' the filesystem and recover its contents from backup.

Regards!

...JRF...
MANOJ SRIVASTAVA
Honored Contributor

Re: reducing lv that is mounted to /home

Olga


You can do it multi user mode also. All you have to do is to login as root and not be in the /home directory . Do a fsucer -ck /home and you shouldbe good to go.


Manoj Srivastava
harry d brown jr
Honored Contributor

Re: reducing lv that is mounted to /home


Olga,

fuser is a weak tool for determining who has what open, so I usually suggest using "lsof"

http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.61/

And like Clay said, make sure you aren't in /home. cd to / first.

live free or die
harry
Live Free or Die
Helen French
Honored Contributor
Solution

Re: reducing lv that is mounted to /home

Hi Olga:

The user, which you are logging in to the system may have it's home directory in /home ! In order to umount /home, you need to login as root. Do a direct telnet and login as root. Check the /etc/securetty if it disables your root telnet session.

HTH,
Shiju
Life is a promise, fulfill it!
James R. Ferguson
Acclaimed Contributor

Re: reducing lv that is mounted to /home

Hi (again):

You were logged-off when you added the kill option to 'fuser' because you had a shell with a path to '/home'.

You will need to be logged in as root when you perform your maintenance. You cannot login as a non-root user if the home directory for that user is the filesystem that you want to manipulate, even if you change ('su') to root. As I indicted above, a common error is to have changed directories into the filesystem that you are trying to unmount (as you found out!).

Regards!

...JRF...