Operating System - HP-UX
1832642 Members
3237 Online
110043 Solutions
New Discussion

Help!How to reduce a file system on HP-UX 11.0

 
Ian lee
Advisor

Help!How to reduce a file system on HP-UX 11.0

We know if you wanna to extend a file system,it can be done through two steps:
1. lvextend -L size lv_path.
2. extendfs -F type raw_lv_path.
But how to reduce a file system?
if you know how to do that,please help me.
thanks.
10 REPLIES 10
Patrick Wallek
Honored Contributor

Re: Help!How to reduce a file system on HP-UX 11.0

The easiest (and safest) way to reduce a file system:

1) Back up your data
2) Blow away the LV
3) Recreate the LV with the smaller size
4) Restore your data

If your LV is an HFS, then the above is your only choice. If it is JFS, then I think there is a way to do it without recreating the LV, but there is NO guarantee that you won't lose some data. The safest is the above steps.
KapilRaj
Honored Contributor

Re: Help!How to reduce a file system on HP-UX 11.0

If u don't hv Online jfs installed , you hv to remove the fs , LV and recreate them with a lesser spaced one.

kaps
Nothing is impossible
Shahul
Esteemed Contributor

Re: Help!How to reduce a file system on HP-UX 11.0


Hi

There is no command for reducing the file system. U can do lvreduce but after that U will have to use newfs command. With this command all data will be vanished.

So better to take a backup and reduce lv.

Best of luck
Shahul
Denver Osborn
Honored Contributor

Re: Help!How to reduce a file system on HP-UX 11.0

I would stick with Patrick's suggestion, but another way is with Online JFS (for vxfs only).

fsadm -d -D -e -E /vxfs_mount
fsadm -F vxfs -b /vxfs_mount
lvreduce -L /dev/vg_name/lv_name

I would still make sure you have a good backup before doing so.

Hope this helps
-denver
Michael Tully
Honored Contributor

Re: Help!How to reduce a file system on HP-UX 11.0

Hi,

To reduce you LV follow this scenario
if you don't have OnLine JFS, remembering
that ONLine JFS can only be used with JFS
filesystems.

# cd /yourfs
backup the filesystem
# tar cvf /dev/rmt/0m .
verify the tape contents
# tar tvf /dev/rmt/0m | tee /tmp/tape.out
Check the /tmp/tape.out file
# umount /yourfs
# lvremove /dev/yourvg/yourlv
# lvcreate -n yourlv /dev/yourvg
# lvextend -L 1024 /dev/yourvg/yourlv (size you want)
# newfs -F vxfs /dev/yourvg/ryourlv (assuming you want vxfs)
# mount /dev/yourvg/yourlv /yourfs
# cd /yourfs
# tar xvf /dev/rmt/0m

HTH
Michael

Anyone for a Mutiny ?
David Allen
Frequent Advisor

Re: Help!How to reduce a file system on HP-UX 11.0

Hi,

There are several option available to reduce a logical volume. If you are lucky, you will have the OnlineJFS product installed, otherwise you will have to do it the hard way - which isn't that hard really, just more involved.

If you have OnlineJFS installed and your filesystem is a JFS (VxFS) filesystem, then you can reduce the logical volume and the filesytem online (NOTE: It always pays to have a backup first).

1. Defrag the filesystem first, eg
fsadm -F vxfs -d -D -e -E /mountdirectory

2. Reduce the filesystem online, eg
fsadm -F vxfs -b [lv_size_MB]M /mountdirectory

NOTE: lv_size_MB is the size in megabytes that the filesystem will be after it is reduced. If you omit the M after lv_size_MB then fsadm assumes you are specifying the new size in blocks.

3. Reduce the logical volume, eg
lvreduce -L [lv_size_MB] /dev/vg_name/lv_name

Refer to the man pages for fsadm_vxfs for more info as there are some gotcha's when reducing a logical volume.


If you do not have OnlineJFS (and this will work for JFS and HFS filesystems), you will need to do the following.

1. Organise downtime, shutdown apps and databases, etc.

2. Backup your data.

3. Unmount the filesystem (this can be done after reducing the logical volume if you want).

4. Reduce the logical volume, eg
lvreduce -L [lv_size_MB] /dev/vg_name/lv_name

If you didn't do step 3, do it now.

5. Now you will need to recreate the filesystem, as the old one has effectively been destroyed, eg
newfs -F fs_type /dev/vg_name/rlv_name

NOTE: The use of the raw device rlv_name and note the block device lv_name. fs_type is HFS or VXFS

6. Restore your data.


Alternatively, you can do a lvremove to destroy the logical volume and then do a lvcreate to recreate it, but then the lvreduce command does that in one step anyway.

Regards,
Dave
Bill McNAMARA_1
Honored Contributor

Re: Help!How to reduce a file system on HP-UX 11.0

2 ways:

1 onlineJFS

bdf
/dev/vg01/lvol1 1234567 kbytes /mount1

fsadm -F vxfs -b 1111111 /mount1
fsadm will defragment and reduce size to 1111111 kbytes


BUT your lvol is still lvdisplay /dev/vg01/lvol1 | grep Mbytes
in size

lets say it's still approx 1230 MB

You then reduce your lvol
lvreduce -L 1110 /dev/vg01/lvol1


That's all online


With out onlinejfs: reduction of fs
backup fs
umount the /mount1
lvremove the lvol | or lvreduce
lvcreate smaller size| the lvol
newfs -F vxfs /dev/vg01/newlvol
restore from backup

You cannot defrag without onlinejfs.

Later,
Bill
It works for me (tm)
Ian lee
Advisor

Re: Help!How to reduce a file system on HP-UX 11.0

Thanks everyone,but I got new trouble,since I resized my file system,the X server can't start on my display.these are the steps I have done:
1.shutdown -y 0
2.tar cvf home.tar /home
3.tar cvf tmp.tar /tmp
4.umount /home,umount /tmp
5.lvreduce -L lv_size lv_path(lv_path is the /tmp and /home logic volume path)
6.newfs -F vxfs raw_lv_path(raw_lv_path is the /tmp and /home raw logic volume path)
7.mount /home,mount /tmp
8.tar xvf home.tar,tar xvf tmp.tar
9.umount /u01(u01 is the dest file system I wanna to extend)
10.lvextend -L lv_size lv_path(lv_path is the /u01 logic volume path)
11.entendfs -F vxfs raw_lv_path(lv_path is the /u01 raw_logic volume path)
12.mount /u01
13.init 4
When it started,theres a error message:
The X-server can not be started on display B2000:0...
For detials look into the file,Dtlogin.errorLogFile(default: /var/dt/Xerrors)
Following is the content of Xerrors:
Unable to open the Graphics Resource Manager.
The error occurred during GRM initialization.
The X11 server must be able to communicate with the
Fatal server error:
GRM process.
^[gXIO: fatal IO error 232 (Connection reset by peer) on X server "B2000:0.0"^M
after 0 requests (0 known processed) with 0 events remaining.^M
Please help me!!!
Thanks.
david Lee
Clemens van Everdingen
Honored Contributor

Re: Help!How to reduce a file system on HP-UX 11.0

Hi,

The problem with this error message is that there is a great variety of possible problems.
For example:

- Temporary loss of network connectivity
- Poor network performance between the application and X server
- Unexpected reset or termination of the X server
- Unexpected behaviour of the X server

I wonder if you already rebooted the system ?
I would try this in the first place as I saw you went back to run level 4 with init4.

Maybe there is some network error, related to the changes you made.



The computer is a great invention, there are as many mistakes as ever, but they are nobody's fault !
Herve BRANGIER
Respected Contributor

Re: Help!How to reduce a file system on HP-UX 11.0