Operating System - HP-UX
1833402 Members
3190 Online
110052 Solutions
New Discussion

Re: reducing size of /dev/vg00/lvol11

 
bobstar
Frequent Advisor

reducing size of /dev/vg00/lvol11

hi ,

can someone tell me what steps i need to take to reduce the above lvol from 6GB to 4GB ?

thanks
19 REPLIES 19
Sandy Chen
Honored Contributor

Re: reducing size of /dev/vg00/lvol11

Hi,

Take ignite backup and then restore it.

regards,
Sandy
I never think of the future. It comes soon enough.
Pete Randall
Outstanding Contributor

Re: reducing size of /dev/vg00/lvol11

That is not one of the normal root volumes so the answer depends on what's in it. Typically you would back it up, lvremove it, re-create it in it's new, smaller size with lvcreate and newfs, then restore.


Pete

Pete
bobstar
Frequent Advisor

Re: reducing size of /dev/vg00/lvol11

hi,

i'm going to tar up the data thats there (not much) and then plan to reduce it

can i get a little more detailed info ?

i'm going to give it a try on a test box

thanks
MarkSyder
Honored Contributor

Re: reducing size of /dev/vg00/lvol11

Do you have 4 Gb of spare disc space? If so,

1. Create a new lvol of 4 Gb. Name the filesystem (for example) /new_filesystem

2. cd to your old filesystem

3. find . -xdev â depth â print|cpio â pmd /new_filesystem

4. cd /etc

5. cp -p fstab fstab.safe

6. swap the entries for your old filesystem and your new one

7. reboot.

Once you are happy that the new filesystem is working you can delete the old one.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Guna_2
Regular Advisor

Re: reducing size of /dev/vg00/lvol11

Hi,

/dev/vgoo/lvol11

first check what u have in that lv?

1) Is it a system directory(i mean opt, usr anythink like that)? or normal data?

If it is data lv then, U can take backup and u can reduce it.

If u have online jfs then u can reduce the lovl directly using fsadm utility.

Other wise u should recreate the filesystem.

Bye
--MGP--
bobstar
Frequent Advisor

Re: reducing size of /dev/vg00/lvol11

unfortunately i dont have 4GB free elswhere so i can create a new one

the data in this lvol is application logs - only 300MG so i can tar it up and put it on another lovol

so once i have done the backup ..

i need to delete it and then re-create it giving it a size of 4GB

... can someone give me the exact commands please

thanks
Bill Hassell
Honored Contributor

Re: reducing size of /dev/vg00/lvol11

1) Terminate all processes that are using this lvol.

2) Backup all the data on this volume. Do it a second time if the data is valuable.

3) umount the lvol. If it is busy, run fuser to locate the processes that are still processing data on this lvol. Properly terminate these processes then umount the volume.

4) lvreduce the lvol to the size you need.

5) Run newfs to erase all the data and create a new filesystem.

6) mount the lvol.

7) Restore the data.

8) Restart the application(s).

Note: If you are running 11.23 and if you have purchased Online JFS and if you are up to date on vxfs patches and if your lvol filesystem version is 4 or greater, then you can try reducing the filesystem using fsadm. If you are missing any of these items, use the procedure above.


Bill Hassell, sysadmin
Andrew Young_2
Honored Contributor

Re: reducing size of /dev/vg00/lvol11

Hi.

Assuming the filesystem is called /applog and that you have removed the contents and that the filesystem is vxfs and that you do not have OnlineJFS

Then

umount /applog
vgreduce -L 4096 /dev/vg00/lvol11
mkfs -Fvxfs /dev/vg00/rlvol11
mount /applog

If however you have OnlineJFS it is easier because you do not need to remove the data.

fasdm -F vxfs -e /applog
fsadm -F vxfs -b 4194304 /applog
lvreduce -L 4096 /dev/vg00/lvol11

HTH
Andrew Y
Si hoc legere scis, nimis eruditionis habes
Andrew Young_2
Honored Contributor

Re: reducing size of /dev/vg00/lvol11

Oops Typo

First line of the OnlineJFS should read:

fsadm -F vxfs -e /applog
Si hoc legere scis, nimis eruditionis habes
bobstar
Frequent Advisor

Re: reducing size of /dev/vg00/lvol11

hi andrew and others

do i not need to lvremove and lvcreate the lvol ?

or do i only need to do this ;

umount /applog
vgreduce -L 4096 /dev/vg00/lvol11
mkfs -Fvxfs /dev/vg00/rlvol11
mount /applog
Patrick Wallek
Honored Contributor

Re: reducing size of /dev/vg00/lvol11

No need to recreate from scratch, but I would modify your commands slightly (per what Bill H. said above):

umount /applog
lvreduce -L 4096 /dev/vg00/lvol11
(you are reducing the LV, not the VG)
newfs -F vxfs /dev/vg00/rlvol11
mount /applog
bobstar
Frequent Advisor

Re: reducing size of /dev/vg00/lvol11

ok thanks,

just 1 question before i give it a go

if i say reduce lvol from 6GB to 4GB

will the free 2GB be available straight away for use on other lvols ie running lvextend ?

Andrew Young_2
Honored Contributor

Re: reducing size of /dev/vg00/lvol11

Hi.

Once you have run lvreduce it becomes available for use elsewhere using lvextend.

Regards

Andrew Y
Si hoc legere scis, nimis eruditionis habes
bobstar
Frequent Advisor

Re: reducing size of /dev/vg00/lvol11

hi

is there any diff between ;

mkfs -Fvxfs /dev/vg00/rlvol11
newfs -F vxfs /dev/vg00/rlvol11

and waht is the significance of the r in rlvol11 ?

it required ?

thanks
Andrew Young_2
Honored Contributor

Re: reducing size of /dev/vg00/lvol11

Hi.

To quote the newfs man page:

The newfs command is a "friendly" front-end to the mkfs command (see mkfs(1M)). The newfs command calculates the appropriate parameters and then builds the file system by invoking the mkfs command.

Each disk has two ways of writing to it, each with a different driver. Character based data is written using the standard filesystem driver (/dev/vgXX/lvolY) which understands the format of the filesystem. However some applications need to write to the device using the raw driver (/dev/vgXX/rlvolY) - the latter is used to write directly to the disk. Usually this is only used if you have something like a database that uses its own internal filesystem format or when you initialise the disk.

HTH

Andrew Y

Si hoc legere scis, nimis eruditionis habes
bobstar
Frequent Advisor

Re: reducing size of /dev/vg00/lvol11

hi ,

ok, i've managed to reduce the lvol

now i want to increase /home by 2GB

but when i try to umount it i get

umount /dev/vg00/lvol5
umount: cannot unmount /home : Device busy
umount: return error 1.

what else do i need to do first ?
Andrew Young_2
Honored Contributor

Re: reducing size of /dev/vg00/lvol11

Hi

/home can usually only be increased in single user mode or using Online JFS. This is because the root user and others have it as their home folder.

What you can try to do is the following.

mkdir /root
cp -p -r /home/root /root
usermod -d /root root (there are other ways to do this - it may complain)

ls -l /root/.profile (just to make sure the profile was copied - if you using ssh then check /root/.ssh too)

Thereafter reboot. That way root will not be on the /home folder

You may then be able to umount /home or at least kill other processes using it.

HTH

Andrew Y
Si hoc legere scis, nimis eruditionis habes
bobstar
Frequent Advisor

Re: reducing size of /dev/vg00/lvol11

thanks

but is there a way i can go into single user mode without making any system changes - customer does not like this idea

i'm sure i did this before using init - but cant get it to work now

Andrew Young_2
Honored Contributor

Re: reducing size of /dev/vg00/lvol11

I see you have a seperate thread for that.

On other Unix systems you could use init s (or S), but read the man init page for HP-UX:

S|s Use for system administration( also known as "single-user state"). When booting into run level S at powerup, the only access to the system is through a shell spawned at the system console as the root user. The only processes running on the system will be kernel daemons started directly by the HP-UX kernel, daemon processes started from entries of type sysinit in /etc/inittab, the shell on the system console, and any processes started by the system administrator. Administration operations that require the system to be in a quiescent state (such as the fsck(1M) operation to repair a file system) should be run in this state. Transitioning into run level S from a higher run level does not terminate other system activity and does not result in a "single-user state"; this operation should not be done.

The only TRUE way to get into single user mode is rebooting.

HTH

Andrew Y


Si hoc legere scis, nimis eruditionis habes