Sunday, August 5, 2018

To Extend ROOT directory with added disk in Oracle Linux 7.5 (xfs_growfs)


To Extend ROOT directory with added disk in Oracle Linux 7.5 (xfs_growfs)


[root@rac1-12cr2 ~]# fdisk -l

Disk /dev/sdh: 19.3 GB, 19327352832 bytes, 37748736 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdc: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x843d33d1

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048    20971519    10484736   83  Linux

Disk /dev/sdf: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x459c80a0

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1            2048    41943039    20970496   83  Linux

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x28354c5a

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    20971519    10484736   83  Linux

Disk /dev/sde: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xb12a1689

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1            2048    41943039    20970496   83  Linux

Disk /dev/sdd: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xc2ab2871

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1            2048    41943039    20970496   83  Linux

Disk /dev/sdg: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x5d17435b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdg1            2048    41943039    20970496   83  Linux

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b547b

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   209715199   103808000   8e  Linux LVM

Disk /dev/mapper/ol-root: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/ol-swap: 5301 MB, 5301600256 bytes, 10354688 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/ol-home: 47.3 GB, 47303360512 bytes, 92389376 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@rac1-12cr2 ~]# fdisk /dev/sdh
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xe0dc5856.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-37748735, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-37748735, default 37748735):
Using default value 37748735
Partition 1 of type Linux and of size 18 GiB is set

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

Calling ioctl() to re-read partition table.
Syncing disks.

[root@rac1-12cr2 ~]# pvcreate /dev/sdh1
  Physical volume "/dev/sdh1" successfully created.

[root@rac1-12cr2 ~]# vgdisplay
  --- Volume group ---
  VG Name               ol
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <99.00 GiB
  PE Size               4.00 MiB
  Total PE              25343
  Alloc PE / Size       25342 / 98.99 GiB
  Free  PE / Size       1 / 4.00 MiB
  VG UUID               K1vOu8-ISS5-lq6T-FNCn-FzYP-gPgp-qeuFdL

[root@rac1-12cr2 ~]# vgextend ol /dev/sdh1
  Volume group "ol" successfully extended

[root@rac1-12cr2 ~]# vgdisplay
  --- Volume group ---
  VG Name               ol
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               116.99 GiB
  PE Size               4.00 MiB
  Total PE              29950
  Alloc PE / Size       25342 / 98.99 GiB
  Free  PE / Size       4608 / 18.00 GiB
  VG UUID               K1vOu8-ISS5-lq6T-FNCn-FzYP-gPgp-qeuFdL

[root@rac1-12cr2 ~]# pvscan
  PV /dev/sda2   VG ol              lvm2 [<99.00 GiB / 4.00 MiB free]
  PV /dev/sdh1   VG ol              lvm2 [<18.00 GiB / <18.00 GiB free]
  Total: 2 [116.99 GiB] / in use: 2 [116.99 GiB] / in no VG: 0 [0   ]


[root@rac1-12cr2 ~]# lvextend /dev/ol/root /dev/sdh1
  Size of logical volume ol/root changed from 50.00 GiB (12800 extents) to <68.00 GiB (17407 extents).
  Logical volume ol/root successfully resized.

[root@rac1-12cr2 ~]# resize2fs /dev/ol/root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/ol/root
Couldn't find valid filesystem superblock.

[root@rac1-12cr2 ~]# mount | grep ol-root
/dev/mapper/ol-root on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)

[root@rac1-12cr2 ~]# df -h
Filesystem           Size  Used Avail Use% Mounted on
devtmpfs             5.6G   24K  5.6G   1% /dev
tmpfs                5.7G  640M  5.0G  12% /dev/shm
tmpfs                5.7G  9.9M  5.6G   1% /run
tmpfs                5.7G     0  5.7G   0% /sys/fs/cgroup
/dev/mapper/ol-root   50G   23G   28G  45% /
/dev/sda1           1014M  217M  798M  22% /boot
/dev/mapper/ol-home   45G   42M   44G   1% /home
12.2                 448G  435G   13G  98% /media/sf_12.2
tmpfs                1.2G  4.0K  1.2G   1% /run/user/42
tmpfs                1.2G   28K  1.2G   1% /run/user/54321
/dev/sr0              56M   56M     0 100% /run/media/oracle/VBox_GAs_5.2.16
tmpfs                1.2G     0  1.2G   0% /run/user/0

[root@rac1-12cr2 ~]# xfs_growfs /dev/mapper/ol-root
meta-data=/dev/mapper/ol-root    isize=256    agcount=4, agsize=3276800 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=13107200, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=6400, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 13107200 to 17824768

[root@rac1-12cr2 ~]# df -h
Filesystem           Size  Used Avail Use% Mounted on
devtmpfs             5.6G   24K  5.6G   1% /dev
tmpfs                5.7G  640M  5.0G  12% /dev/shm
tmpfs                5.7G  9.9M  5.6G   1% /run
tmpfs                5.7G     0  5.7G   0% /sys/fs/cgroup
/dev/mapper/ol-root   68G   23G   46G  33% /
/dev/sda1           1014M  217M  798M  22% /boot
/dev/mapper/ol-home   45G   42M   44G   1% /home
12.2                 448G  435G   13G  98% /media/sf_12.2
tmpfs                1.2G  4.0K  1.2G   1% /run/user/42
tmpfs                1.2G   28K  1.2G   1% /run/user/54321
/dev/sr0              56M   56M     0 100% /run/media/oracle/VBox_GAs_5.2.16
tmpfs                1.2G     0  1.2G   0% /run/user/0
[root@rac1-12cr2 ~]#

No comments:

Post a Comment