Resize filesystem on SAN LUN

[root@log01 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
...edited...
/dev/sda1             104G   82G   17G  83% /var/log/syslog-ng
/dev/mapper/logs_vg_logs_lv
                      197G  187G   32K 100% /var/log/
[root@gy-asp-log01 ~]#
[root@gy-asp-log01 ~]# fdisk -l

...edited...
Disk /dev/sdb: 322.1 GB, 322122547200 bytes
255 heads, 63 sectors/track, 39162 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       26108   209712478+  83  Linux


[root@gy-asp-log01 ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               rgs_logs_vg
  PV Size               200.00 GB / not usable 0
  Allocatable           yes (but full)
  PE Size (KByte)       4096
  Total PE              51199
  Free PE               0
  Allocated PE          51199
  PV UUID               tkKoQd-S28P-36ev-PsNW-cWCA-otnv-YIXtH3
[root@log01 ~]# fdisk /dev/sdb

The number of cylinders for this disk is set to 39162.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 322.1 GB, 322122547200 bytes
255 heads, 63 sectors/track, 39162 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       26108   209712478+  83  Linux

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (26109-39162, default 26109):
Using default value 26109
Last cylinder or +size or +sizeM or +sizeK (26109-39162, default 39162):
Using default value 39162

Command (m for help): p

Disk /dev/sdb: 322.1 GB, 322122547200 bytes
255 heads, 63 sectors/track, 39162 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       26108   209712478+  83  Linux
/dev/sdb2           26109       39162   104856255   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@log01 ~]# partprobe
[root@log01 ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               logs_vg
  PV Size               200.00 GB / not usable 0
  Allocatable           yes (but full)
  PE Size (KByte)       4096
  Total PE              51199
  Free PE               0
  Allocated PE          51199
  PV UUID               tkKoQd-S28P-36ev-PsNW-cWCA-otnv-YIXtH3

[root@log01 ~]# pvcreate /dev/sdb2
  Physical volume "/dev/sdb2" successfully created
[root@log01 ~]# vgdisplay
  --- Volume group ---
  VG Name               logs_vg
...edited...
  VG Size               200.00 GB
  PE Size               4.00 MB
  Total PE              51199
  Alloc PE / Size       51199 / 200.00 GB
  Free  PE / Size       0 / 0
  VG UUID               7V4RnW-fb5B-smYL-6h22-KChA-k7Tx-vOzVZO

[root@log01 ~]# vgextend rgs_logs_vg /dev/sdb2
  Volume group "logs_vg" successfully extended
[root@log01 ~]# vgdisplay
  --- Volume group ---
  VG Name               ogs_vg
...edited... 
  VG Size               299.99 GB
  PE Size               4.00 MB
  Total PE              76798
  Alloc PE / Size       51199 / 200.00 GB
  Free  PE / Size       25599 / 100.00 GB
  VG UUID               7V4RnW-fb5B-smYL-6h22-KChA-k7Tx-vOzVZO

[root@log01 ~]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/logs_vg/logs_lv
  VG Name                logs_vg
  LV UUID                OsLIKZ-toq8-uQZz-YFie-XL3S-NExc-8bRTUH
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                200.00 GB
  Current LE             51199
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0



[root@log01 ~]# lvextend -l +25599 /dev/logs_vg/logs_lv
  Extending logical volume rgs_logs_lv to 299.99 GB
  Logical volume logs_lv successfully resized

[root@log01 ~]#
[root@log01 ~]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/logs_vg/logs_lv
  VG Name                logs_vg
...edited...
  LV Size                299.99 GB
  Current LE             76798
  Segments               2
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0

[root@log01 ~]# resize2fs -p /dev/logs_vg/logs_lv
resize2fs 1.35 (28-Feb-2004)
/dev/logs_vg/logs_lv is mounted; can't resize a mounted filesystem!

[root@log01 ~]# umount /dev/ogs_vg/logs_lv


[root@log01 ~]# e2fsck -f /dev/logs_vg/logs_lv
e2fsck 1.35 (28-Feb-2004)
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
RGS_LOGS: 26832/26214400 files (22.2% non-contiguous), 49806380/52427776 blocks


[root@log01 ~]# resize2fs -p /dev/logs_vg/logs_lv
resize2fs 1.35 (28-Feb-2004)
Resizing the filesystem on /dev/logs_vg/logs_lv to 78641152 (4k) blocks.
Begin pass 1 (max = 800)
Extending the inode table     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/logs_vg/logs_lv is now 78641152 blocks long.

[root@log01 ~]# mount -a


[root@log01 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
...edited...
/dev/mapper/logs_vg_logs_lv
                      296G  187G   97G  66% /var/log/GRS
 
rb/evaresizesanfilesystem.txt · Last modified: 04/09/2019 14:38 by 127.0.0.1