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.
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.
0 comments:
Post a Comment