Many Occasion we used to get the task for extending the existing File systems when we don't have space in Volume Group. Let we can start from our High level plan. In the below example we are going to extend Fs LVOL1_mnt online on our unixrock test server.
High Level Plan
- Identify the newly added disk.
- Ensured the full backup of File system and required configurations backups.
- Initialize and Add the disk into Volume group.
- Extend the Logical Volume.
- Resize the Logical Volume.
Currently FS size is
[root@unixrock /]# df -h /LVOL1_mnt Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg01-LVOL1 24M 1.2M 22M 5% /LVOL1_mnt [root@unixrock /]#
Checking host SCSI connection before scanning the disk.
[root@unixrock /]# cat /proc/scsi/scsi Attached devices: Host: scsi1 Channel: 00 Id: 00 Lun: 00 Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00 Type: CD-ROM ANSI SCSI revision: 05 Host: scsi2 Channel: 00 Id: 00 Lun: 00 Vendor: VMware, Model: VMware Virtual S Rev: 1.0 Type: Direct-Access ANSI SCSI revision: 02 Host: scsi5 Channel: 00 Id: 00 Lun: 00 Vendor: OPNFILER Model: VIRTUAL-DISK Rev: 0 Type: Direct-Access ANSI SCSI revision: 04 Host: scsi5 Channel: 00 Id: 00 Lun: 01 Vendor: OPNFILER Model: VIRTUAL-DISK Rev: 0 Type: Direct-Access ANSI SCSI revision: 04 Host: scsi5 Channel: 00 Id: 00 Lun: 02 Vendor: OPNFILER Model: VIRTUAL-DISK Rev: 0 Type: Direct-Access ANSI SCSI revision: 04 Host: scsi5 Channel: 00 Id: 00 Lun: 03 Vendor: OPNFILER Model: VIRTUAL-DISK Rev: 0 Type: Direct-Access ANSI SCSI revision: 04 [root@unixrock /]#According to the above output, Scanning the new disk on host5 (Host: scsi5)
[root@unixrock ~]# echo "- - -" >/sys/class/scsi_host/host5/scan [root@unixrock ~]# [root@unixrock /]# fdisk -l Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000d0e67 Device Boot Start End Blocks Id System /dev/sda1 * 1 39 307200 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 39 549 4096000 82 Linux swap / Solaris Partition 2 does not end on cylinder boundary. /dev/sda3 549 2611 16567296 83 Linux Disk /dev/mapper/vg01-LVOL1: 25 MB, 25165824 bytes 255 heads, 63 sectors/track, 3 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/sdb: 234 MB, 234881024 bytes 8 heads, 56 sectors/track, 1024 cylinders Units = cylinders of 448 * 512 = 229376 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x8cb5a280 Device Boot Start End Blocks Id System /dev/sdb1 1 100 22372 83 Linux Disk /dev/sde: 234 MB, 234881024 bytes 8 heads, 56 sectors/track, 1024 cylinders Units = cylinders of 448 * 512 = 229376 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x2d576e29 Device Boot Start End Blocks Id System /dev/sde1 1 100 22372 83 Linux Disk /dev/sdf: 234 MB, 234881024 bytes 8 heads, 56 sectors/track, 1024 cylinders Units = cylinders of 448 * 512 = 229376 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 [root@unixrock /]#Found the new disk /dev/sdf and initializing
[root@unixrock /]# pvcreate /dev/sdf Writing physical volume data to disk "/dev/sdf" Physical volume "/dev/sdf" successfully created [root@unixrock /]# [root@unixrock /]# pvs PV VG Fmt Attr PSize PFree /dev/sdd1 vg01 lvm2 a-- 20.00m 8.00m /dev/sde1 vg01 lvm2 a-- 20.00m 8.00m /dev/sdf lvm2 a-- 220.00m 220.00m [root@unixrock /]#Extending VolumeGroup with physical Volume
[root@unixrock /]# vgextend vg01 /dev/sdf Volume group "vg01" successfully extended [root@unixrock /]# [root@unixrock /]# pvs PV VG Fmt Attr PSize PFree /dev/sdd1 vg01 lvm2 a-- 20.00m 8.00m /dev/sde1 vg01 lvm2 a-- 20.00m 8.00m /dev/sdf vg01 lvm2 a-- 220.00m 220.00m [root@unixrock /]#Extending Logical Volume
[root@unixrock /]# lvextend -L +10M /dev/mapper/vg01-LVOL1 Rounding size to boundary between physical extents: 12.00 MiB Extending logical volume LVOL1 to 36.00 MiB Logical volume LVOL1 successfully resized [root@unixrock /]# [root@unixrock /]# df -h /LVOL1_mnt Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg01-LVOL1 24M 1.2M 22M 5% /LVOL1_mnt [root@unixrock /]#Still its showing the same size even after extending the logical Volume.Creating File system on extending space
[root@unixrock /]# resize2fs /dev/mapper/vg01-LVOL1 resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/mapper/vg01-LVOL1 is mounted on /LVOL1_mnt; on-line resizing required old desc_blocks = 1, new_desc_blocks = 1 Performing an on-line resize of /dev/mapper/vg01-LVOL1 to 36864 (1k) blocks. The filesystem on /dev/mapper/vg01-LVOL1 is now 36864 blocks long. [root@unixrock /]# [root@unixrock /]# df -h /LVOL1_mnt Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg01-LVOL1 36M 1.2M 33M 4% /LVOL1_mnt [root@unixrock /]#
No comments:
Post a Comment