LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (http://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   Replacing 200 GB LUN with 100 GB LUN in LVM (http://www.linuxquestions.org/questions/linux-enterprise-47/replacing-200-gb-lun-with-100-gb-lun-in-lvm-936664/)

rajaniyer123 03-27-2012 06:37 AM

Replacing 200 GB LUN with 100 GB LUN in LVM
 
Hi,

In one of my RHEL server I have one root volume group in which websphere application is running. [100GB in size]

In case of file system extension I have extended with 200 GB instead of 100 GB, by creating 100 GB logical volume on 200 GB.

Now in the same ref. because of the performance issue I have to remove 200 GB and replace the same by 100 GB.

Could any one provide detailed steps.

Also I have below concerns regarding the same.

After above activity what will be chances of File System inconsistency ?
What about functionality of Application and their associated Dynamic Link libraries after replacing the 200 GB Disk with 100 GB Disk.
Is there any way from which I can ensure existing underlying extent allocation whether they are sequential not random, and in case of replacing the 200 GB disk with 100 GB no data will be left out.


Please suggest.

Thanks
Rajan

MensaWater 03-27-2012 07:12 AM

That's a little confusing. You talk about "LUNs" but seem to be implying "disks". Let'g go over some basics:

disk = Physical hard drive
LUN = Logical Unit - This is a subdivision of a RAID set.
LVM = Logical Volume Manager
VG = Volume Group - This is LVM top level that contains at least one PV and can have one or more LVs.
PV = Physical Volume - This is a disk (or a partition or a meta disk) that you have added to a VG
LV = Logical volume - This is a subdvision of VG that you layout your filesystem on (or make swap or raw device on)
filesystem = The layout you did on the LV and mounted to a mount point directory.

The question you asked appears to be:
You have a 200GB LV that you want to reduce to a 100GB LV.
For this you'd generally want to:
-Verify the data contained in the filesystem is less than 100 GB with df command.
-Stop any applications using the filesystem.
-Umount the filesystem.
-Run e2fsck on the LV path of the filesystem.
-Run resize2fs on the LV path of the filesystem specifying new size you want for the filesystem.
-Run lvreduce on the LV path of the filesystem specifying new size you want for the LV.
-Remount the filesystem
-Restart the apps.


The question your other description makes me think you are asking is:
You have a VG with a 200 GB disk (PV) in it that you want to swap for a 100 GB disk (PV).
If possible the best way to do this would be to add the 100 GB disk while the 200 GB disk is still there and use pvcreate to add the 100 GB disk as a PV to the VG. You can then use pvmove to move the extents for the LV from the 200 GB PV to the 100 GB PV. After that you can use vgreduce to remove the 200 GB disk from the VG if you want.

For all the commands listed there are man (manual) pages so you can get more details by typing "man" followed by the command name e.g.
man e2fsck
man vgreduce
man umount

rajaniyer123 03-27-2012 07:28 AM

Hi
 
Thanks for the update

In my case I have to perform below steps as per your comments.

You have a VG with a 200 GB disk (PV) in it that you want to swap for a 100 GB disk (PV).
If possible the best way to do this would be to add the 100 GB disk while the 200 GB disk is still there and use pvcreate to add the 100 GB disk as a PV to the VG. You can then use pvmove to move the extents for the LV from the 200 GB PV to the 100 GB PV. After that you can use vgreduce to remove the 200 GB disk from the VG if you want.


Please let me know are there any chances of issues after using the vgreduce command in terms of data loss/file system in consistency etc..

Also is there any known issues after replacing the 200 GB disk with 100 GB.

Please suggest

MensaWater 03-27-2012 07:46 AM

There is always a chance of data loss due to physical hard drive failures, cosmic rays or the whims of fate. You should be backing up your system on a regular basis. Prior to doing disk maintenance of any sort doing a backup is a good idea.

Any time you are "reducing" there is a higher chance of data loss than if you are "extending". However, doing this kind of activity is one of the main reasons LVM was created. It is simple to add a disk to an existing VG. It is relatively simple to do a pvmove to move extents off one PV to another. Once the extents have been moved you should be able to safely remove the original disk. Prior to doing that you can run "pvdisplay -v" on the original disk to verify there are no extents in use on it any longer.

However, no one is going to guarantee you won't have data loss because YOU are the one doing this not us. It is however reasonable to assume you won't because these are standard operations.

rajaniyer123 03-27-2012 12:32 PM

Thanks for the help.


All times are GMT -5. The time now is 03:00 PM.