Operating System - HP-UX
1834744 Members
2883 Online
110070 Solutions
New Discussion

decrease /usr and increase /var

 
jane zhang
Regular Advisor

decrease /usr and increase /var

I have the following file system layout:
/dev/vg00/lvol7 1024000 452984 571016 44% /var
/dev/vg00/lvol6 2764800 1376856 1377144 50% /usr

I need to decrease /usr and give the space to /var.

Is it OK to lvreduce /usr and lvextend /var in single usr mode?

Thanks,

Jane
8 REPLIES 8
Pete Randall
Outstanding Contributor

Re: decrease /usr and increase /var

Jane,

That's definitely the easy way to do it since you need to unmount them.


Pete

Pete
jane zhang
Regular Advisor

Re: decrease /usr and increase /var

So I can decrease /usr without side effect? I have done lvextend but never lvreduce on /usr.

OK, I will give it a try. I have online JFS installed, can I lvreduce in mutiuser mode?

Thanks,

Jane
Sundar_7
Honored Contributor

Re: decrease /usr and increase /var

Jane,

Reducing the LV is only very rarely succesful especially with the layout versions prior to 4.

Keep a good backup of /usr before reducing the lv.

You could use online JFS to defrag the file system before reducing but again I assume you dont have Online JFS since you have mentioned you need to bring down the system to reduce the LV.

Before lvreduce, you need to execute fsadm to reduce the filesystem size.

After lvextend, you can execute either fsadm or extendfs to increase the filesystem size.

-- Sundar.
Learn What to do ,How to do and more importantly When to do ?
Sundar_7
Honored Contributor

Re: decrease /usr and increase /var

If you have OnlineJFS installed then why bother going to the single user mode ?

Even with OnlineJFS, lvreduce is kinda destructive

1) Backup /usr
2) fsadm -F vxfs -D -E -d -e /usr

This will defrag the filesystem and thus incrases the chances of being able to reduce the filesystem size.

3) fsadm -F vxfs -b m /usr
4) lvreduce -L XXX /dev/vg00/lvolX
5) lvextend -L YYY /dev/vg00/lvolY
6) fsadm -F vxfs -b m /var
7) bdf and confirm

-- Sundar.
Learn What to do ,How to do and more importantly When to do ?
jane zhang
Regular Advisor

Re: decrease /usr and increase /var

hi Sundar,

Thanks for the details and warnings.

I need to increase /var to put other system's image there ( this machine is my ignite server).

I have found the way to put the images on other files system (/homes). So I won't risk to do it. The good lesson I learned is that to calculate the size while installing the OS or leave some unallocated space in vg00.

regards,

Jane
Sanjay_6
Honored Contributor

Re: decrease /usr and increase /var

lvreduce might be a problem. Doing lvextend will not be a problem. If you have onlineJFS, you can even do this online.

If you have onlineJFS, you can use this procedure to reduce the size,

http://www1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000062938991

The itrc doc id is A4360299.

Hope this helps.

regds
Pete Randall
Outstanding Contributor

Re: decrease /usr and increase /var

Jane,

Sorry, I didn't realize you Online JFS. In that case, you don't need to worry about single user. I think Sundar's done a pretty good job of elaborating the steps involved so I won't bother repeating. Good luck!


Pete

Pete
Sergej_5
Regular Advisor

Re: decrease /usr and increase /var

I get the point!
Thnx guys!
What i did:

# fsadm -F vxfs -b 6000m /opt
vxfs fsadm: /dev/vg00/rlvol6 is currently 7028736 sectors - size will be reduced
vxfs fsadm: allocations found in shrink range, moving data
# lvreduce -L 6000 /dev/vg00/lvol6
When a logical volume is reduced useful data might get lost;
do you really want the command to proceed (y/n) : y
Logical volume "/dev/vg00/lvol6" has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

Then with SAM increase /usr volume ;)

Brgds,
Sergej