Reply to Message

Reply to Message

View discussion in a popup

Replying to:
1 Nickel

Re: Increase size of LUN


I was thinking to follow the following procedure:

First creates a new partition using the entire un-partitioned disk space on the unused hard drive on a single partition LUN (/dev/sdc1) and initializes it as a physical volume.
NOTE: Physical volumes can also be created directly on a disk device, such as /dev/sdc, without first creating a partition.

1. Create a new partition, because you want it to occupy the entire disk, you can accept the default start and end cylinders by pressing Enter. Create a lvm partition with fdisk
#fdisk /dev/sdc
n ( new partition )
p ( type primary )
1 ( first partition )
t ( select partition type )
8e ( lvm )
w (write)

Print to make sure the changes are correct
Command (m for help): p
Disk /dev/sdc: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x58bbc73f
   Device Boot     Start   End      Blocks     Id  System
   /dev/sdc1       1       10240    10485744   83  Linux

To tell the kernel to re-read the partition table, either reboot the system or use the partprobe command:
# partprobe /dev/sdc
If successful, this command will not display any output

2. Initialize the New Device as an LVM Physical Volum, create physical volume from new device
#pvcreate /dev/sdc1

3.Extend the Volume Group Onto the New Physical Volume
#vgextend name_vg /dev/sdc1

4. It is possible to specify a size in K, M, G, or other
units using the -L option. However, in some cases,
rounding might cause this to fail:
Extend the LV (logical volume) to the desired size:
#lvextend -L +2G /dev/name_vg/name_lv

5. After extending the volume group and the logical volume, you can now increase the size of the file system.
In Red Hat Enterprise Linux 5 and later and Red Hat Enterprise 6 and later, this is done for ext3 file systems
using the resize2fs command. This procedure can be performed while the file system is live and
mounted. Resize the filesystem to cover the newly extended LV:
#resize2fs /dev/name_vg/name_lv
newly resized filesystem should now be available.

6.I recommend this step, so check File-System Integrity after the Resize Procedure While not absolutely necessary, it is useful to run a file-system check after resizing. NOTE: This must be done while the file system is unmounted, so downtime might be required to stop any applications from using it.
Once the file system is unmounted, you can check it using e2fsck (-f forces the check):
# e2fsck -f /dev/name_vg/name_lv
e2fsck 1.41.12 (dd-mm-yyyy)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/name_vg/name_lv: xx/xxxxxx files (0.0% non-contiguous),
xxxxxx/xxxxxx blocks

Note: I recommend that all critical data be backed up and verified before making any changes to the underlying storage as an unforeseen problem might occur.

0 Kudos