Operating System - HP-UX
1822146 Members
4242 Online
109640 Solutions
New Discussion юеВ

How do I defrag a vxfs Filesystem?

 
Richard Woolley
Frequent Advisor

How do I defrag a vxfs Filesystem?

Hi,

can anybody help? I need to reduce the space allocated in /home (currently set at 256MB - way too high only 5MB being used) to give back to /usr. They are both vxfs filesystems and the OnlineJFS product is installed. I have read that I will need fsadm and lvreduce, however the documentation recommends defragging the filesystem first. This is what i would like to know how to do. So can anyone tell me the command i need to defrag /home(incidentaly this is lvol8)?

thanks in advance for help will allocate points for any help/answers :)

mark.
15 REPLIES 15
Tom Geudens
Honored Contributor

Re: How do I defrag a vxfs Filesystem?

Hi,
You'll find this info in man fsadm_vxfs
fsadm -D -> report on directory fragmentation
fsamd -d -> directory defrag
fsadm -E -> report on extend fragmentation
fsadm -e -> extend defrag

You'll need onlineJFS (that went without saying :-)
Hope this helps,
Tom Geudens
A life ? Cool ! Where can I download one of those from ?
Heiner E. Lennackers
Respected Contributor

Re: How do I defrag a vxfs Filesystem?

Hi,

defragmentation is also doen with fsadm, options -d and -e, but like reducing the size
of a filesystem it is not part of the core os,
but a additional product/license.
To do a defragmentation does not guaranty, that you are able to reduce the size of a
filesystem.

Heiner
if this makes any sense to you, you have a BIG problem
John Carr_2
Honored Contributor

Re: How do I defrag a vxfs Filesystem?

Hi

if you can have an outage take the easy route

backup /home to another file system

remove the logical volume

create new logical volume of appropiate sixe

copy backup to new /home

new volume will be totally defragmented and the data contigous.

even JFS has been know to fail on an lvreduce so make sure you have a backup whatever route you take.

good luck
John.
Trond Haugen
Honored Contributor

Re: How do I defrag a vxfs Filesystem?

Tom and Hiner have the answers.
The quickest solution for you would be to create a new lvol/filesystem for /home. Temporarily mount it and copy the contents of /home over. Then umount both and mount the new filesystem on /home.
Then you can edit fstab to reflect the new lvol and lvremove the old one (and give more space to /usr).

Regards,
Trond
Regards,
Trond Haugen
LinkedIn
Peter Kloetgen
Esteemed Contributor

Re: How do I defrag a vxfs Filesystem?

Hi Mark,

the best way to do a defragmentation of your file system is to do a backup of your file system, remove the old logical volume, create a new one of same size or bigger, and restore your data into this lvol. If you use online JFS, which you must pay for, you can do a defragmentation without this procedure, remember to do a backup before proceeding.

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Richard Woolley
Frequent Advisor

Re: How do I defrag a vxfs Filesystem?

Hi thanks for all the reponses.

Im having trouble with the fsadm -b (new size) /home.

It exits with errno 16.

anyone encountered this and know the fix?

I would like to create new lv, copy over to new lv, umount old and new, then remount new on old mount point. But i dont have any system outage time :( not till weekend anyway!

mark.
Clemens van Everdingen
Honored Contributor

Re: How do I defrag a vxfs Filesystem?

Hi,
This depends very much on which version HP-UX you are using.

So let us know !

C.
The computer is a great invention, there are as many mistakes as ever, but they are nobody's fault !
Trond Haugen
Honored Contributor

Re: How do I defrag a vxfs Filesystem?

Unfortunately the error 16 means there are inodes or extents, in use in the area you want to "reduce away".
The easiest way out of this is to create a new filesystem etc...

Regards,
Trond
Regards,
Trond Haugen
LinkedIn
Clemens van Everdingen
Honored Contributor

Re: How do I defrag a vxfs Filesystem?

Hi,

For sure the best way in this is to recreate a new file system.

Suc6.
C.
The computer is a great invention, there are as many mistakes as ever, but they are nobody's fault !
Tom Geudens
Honored Contributor

Re: How do I defrag a vxfs Filesystem?

Hi,
That particular error is "normal" :-(.
Example :
/home 100Mb
extend it to
/home 200Mb
and then try to reduce ... I wouldn't go below 140Mb. I made a type one day and because of that lost a couple of Mb's (which is no great deal, I agree :-).

The way it works I'm afraid ...
Tom Geudens
A life ? Cool ! Where can I download one of those from ?
Richard Woolley
Frequent Advisor

Re: How do I defrag a vxfs Filesystem?

it is hp-ux 11.0

i think now it would be best for me to create new and copy data into new one at weekend.

thanks for all your help :)

mark.
Darrell Allen
Honored Contributor

Re: How do I defrag a vxfs Filesystem?

Hi Mark,

Though it is possible with Online JFS to reduce the size of a JFS filesystem "on the fly", often it fails because the filesystem has stored some info in the space that would be freed by shrinking its size. This is often the case when drastically reducing the size of the filesystem.

The purpose of defragging (fsadm -de) is to hopefully free that space. Defragging will sometimes free the space to be reduced but often it doesn't. I don't think you can readily determine if defragging will help without trying it.

If fsadm fails to shrink the filesystem, you basically have to rebuild it.

If fsadm succeeds, you still need to shrink the filesystem's logical volume with lvreduce.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
Sanjay_6
Honored Contributor

Re: How do I defrag a vxfs Filesystem?

Hi Mark,

REducing the lv is always a problem. The best thing for you to do would be to take a backup of the filesystem, remove the logicval volume and recreate the logical volume with the new size you want. And restore from the backups.

Hope this helps.

Regds
Ramakrishnan Kellio
New Member

Re: How do I defrag a vxfs Filesystem?

Mark,

You can try this.

The best way to do is take the backup of the filesystem in a disk, resize the filesystem. This may destroy data in the original filesystem. Don't bother... you have the backup! Then remove all the files in the lvol8 filesystem and then restore from the backup.

Cheers...
Ramakrishnan
Problem is easy to solve if you look at from all perspective
twang
Honored Contributor

Re: How do I defrag a vxfs Filesystem?

1.To defragment an HFS file system
You can defragment an HFS file system by backing it up to tape, removing and recreating it, then recovering the data from the tape.
The example that follows shows an alternative method, using dcopy, and assumes you have enough disk space to create a new logical volume at least as large as /dev/vg01/lvol8. We'll operate on the /work file system, which resides on the logical volume /dev/vg01/lvol8.

Step 1. Back up the file system; for example,

tar cv /work

backs up /work to the system default tape device, /dev/rmt/0m.
Step 2. Create a new logical volume (see Adding a Logical Volume) but do not mount it to any file system.

We'll assume this new logical volume is /dev/vg01/lvol9.
Step 3. Make sure no one has files open in /work and that it is no one's current working directory, for example:

fuser -cu /work
Step 4. Unmount /work:

umount /work
Step 5. Write out the contents of /work to /dev/vg01/lvol9:

dcopy -v /dev/vg01/rlvol8 /dev/vg01/lvol9
Step 6. Mount the new logical volume to the mount point of the original file system, /work:

mount /dev/vg01/lvol9 /work

You can now reuse the original logical volume /dev/vg01/lvol8) or remove it (see Removing a Logical Volume).


2.To defragment a JFS file system using SAM



Execute sam.

Select Disks and File Systems functional area.

Select the File Systems application.

Select the desired JFS (VxFS) file system.

Select the Actions menu.

Select the VxFS Maintenance menu item.

You can choose to view reports on extent and directory fragmentation.

Select Reorganize Extents and/or Reorganize Directories to defragment your JFS file system.