Operating System - HP-UX
1838163 Members
3425 Online
110124 Solutions
New Discussion

How do I reallocate disk space?

 
Daniel Navarro
Occasional Contributor

How do I reallocate disk space?


Newbie Question:

How do I reallocate space from one mount point to another. For example, let say I do a df -k :

/home (/dev/vg00/lvol5 ) : 1018327 total allocated Kb
458014 free allocated Kb
560313 used allocated Kb

/test (/dev/vg00/lvol4 ) : 31823 total allocated Kb
14860 free allocated Kb
16963 used allocated Kb

Now let's say I wanted to grab some disk space from /home and add it to /test to increase it's disk space. How would I go about doing this?

TIA,
Daniel N.
10 REPLIES 10
Shannon Petry
Honored Contributor

Re: How do I reallocate disk space?

Unless your using Veritos then you need to REMOVE the file system that you want to shrink, then you will have space to add to another file system. There is no way of "shrinking" a current LVM with standard tools. Veritos will let you do amazing things, but comes with about a 100K price tag as well.

IMHO, a well planned out system will alleviate this. Lots of people tend to put all of their eggs into one basket, leaving problems like you have. If space is not curently needed, it should not necessarily be allocated just to be used up. You can always expand filesystems (though sometimes a nuisance), but can never reduce one on the fly!

Regards,
Shannon
Microsoft. When do you want a virus today?
James R. Ferguson
Acclaimed Contributor

Re: How do I reallocate disk space?

Hi Daniel:

If you have Online JFS (and your filesystems are vxfs ones, of course), then it is sometimes possible to shrink the size of a filesystem dynamically. In that case, you might free extents from one filesystem which could be added to another.

If your case does not meet this criteria, then you must backup the filesystem you want to shrink, destroy it and recreate it.

...JRF...

Joseph C. Denman
Honored Contributor

Re: How do I reallocate disk space?

Hi Daniel,

You really did not give enough info for me to give you a really good answer, but here goes:

You have a couple of options:

1. Backup /home. Remove and recreate or lvreduce /home to create it as a smaller lv. Then restore the /home data. Then use lvextend to increase the size of /test.

2. You could create a symbolic link to /home from test to use the space.

mkdir /home/test_data
cd /test
ln -s mynewdir /home/test_data


The second is easier, but sometimes too many links get confusing.

...jcd...
If I had only read the instructions first??
Tim D Fulford
Honored Contributor

Re: How do I reallocate disk space?

Dan

Joseph's answer is what I would have said.

However, (& I hesitated ALOT about this) JRF's reply is not quite true, you can only shrink a OnlineJFS if you have not written to it!! The first write stops you shrinking it! The HP manual & courses say (well, did say) you can shrink!

Good luck anyway

Tim
-
James R. Ferguson
Acclaimed Contributor

Re: How do I reallocate disk space?

Hi Tim:

I should have been much more explicit. It *is* possible to shrink a JFS filesystem. It is often *not* possible with older versions of JFS and JFS filesystems. The failure occurs when inuse inodes occupy the space to be reduced. Sometimes an online defragmentation of the filesystem beforehand will allow a subsequent reduction to succeed.

Using JFS version 3.3 allows a greater chance of success. However, you must 'vxupgrade' your filesystems to version-4 *and* use JFS 3.3 to raise the assurance of success.

JFS 3.3 can be used with 11.0; is the default on 11.11; but is not available for 10.20.

BTW, Tim, "disagreement" is what this forum is about, don't ever be bashful. Healthy disagreement simply brings more information. Thanks, and regards!

...JRF...
Joseph C. Denman
Honored Contributor

Re: How do I reallocate disk space?

James, you are the man!!!!!

DON'T MESS WITH THE TOP DOG.

Thanks for the info great info.

...jcd...
If I had only read the instructions first??
MANOJ SRIVASTAVA
Honored Contributor

Re: How do I reallocate disk space?

Hi Daniel

You need to have a backup , coz in case you reduce it there may be chance for you loosing some files .Ans also the size is lvol is aorung 1 gb which shouldnt be a problem to be backed up .

Take the backup , reduce the size , reallocate the space and restore the back up.


Manoj Srivastava

Daniel Navarro
Occasional Contributor

Re: How do I reallocate disk space?


All,

Thanks for all the replies. Now all I need to do is find out what kind of system I'm on and I'll be in semi-good shape. Since I am more of an Oracle Developer rather than a Sys. Admin, and we just recently lost our Sys-Admin, I am starving for knowledge without knowing where the fountain of knowledge is. Can someone please tell me what commands I can use to query the system to find out if/what kind of Volume Manager I have installed and what 'manpages' can I look for to extend file sizes?

O.S. = B.11.00 A 9000/821 (t1)

Again TIA,
Daniel N.
Joseph C. Denman
Honored Contributor

Re: How do I reallocate disk space?

Daniel,

You are using the LVM that comes standard with HPUX.

Things you might want to look at:

man vgdisplay
man lvextend
man extendfs

However, If you are new to hpux/lvm, I would recommend using SAM.

...jcd...
If I had only read the instructions first??
James R. Ferguson
Acclaimed Contributor

Re: How do I reallocate disk space?

Hi (again) Daniel:

A good guide to LVM tasks can be found in "Managing Systems and Workgroups: A Guide for HP-UX System Administrators". Take a look, particularly at this chapter:

http://docs.hp.com/hpux/onlinedocs/B2355-90742/B2355-90742.html

As Joseph suggested, the man pages are well worth a look, too.

'fstyp' (see the man pages) can be used to determine the type of filesystem you have. You can also list your /etc/fstab to see.

# fstyp -v /dev/vgXX/lvolX

To see if you have Online JFS installed, do:

# swlist -l bundle|grep -i JFS

If the output of this command does *not* show a component with the word "online" then you do not have Online JFS. The Online version is a separate add-on to the base product.

Remember that SAM can easily lead you through the process of disk and filesystem maintenance with a miniumum of knowledge. This is always an option, too.

...JRF...