While running an oracle upgrade i ran into file system space issues, in Rhel 7 without any downtime, how we can extend the volumes please check here, There are some steps that we have to follow :
1. Present a new physical disk to the server
2. Adding the new physical disk to an exisiting Volume Group.
3. Expanding a logical volume within that Volume Group to use the new disk space.
4. Notify the operating system about the change in size.
[oracle@rhel7 ~]$ su -
Password:
Last login: Sat Mar 28 21:11:53 IST 2020 on pts/3
[root@rhel7 ~]# fdisk -l
Disk /dev/sda: 128.8 GB, 128849018880 bytes, 251658240 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: 0x000b49f1
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2050047 1024000 83 Linux
/dev/sda2 2050048 100370431 49160192 8e Linux LVM
Disk /dev/mapper/rhel-root: 41.9 GB, 41943040000 bytes, 81920000 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/rhel-swap: 8388 MB, 8388608000 bytes, 16384000 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
Step 1: Present the new physical disk to the server.
And Step 2: Add the new physical disk to an existing Volume Group.
[root@rhel7 ~]# fdisk /dev/sda
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.
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): e
Partition number (3,4, default 3):
First sector (100370432-251658239, default 100370432):
Using default value 100370432
Last sector, +sectors or +size{K,M,G} (100370432-251658239, default 251658239): +40G
Partition 3 of type Extended and of size 40 GiB is set
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
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 or after you run partprobe(8) or kpartx(8)
Syncing disks.
# Now run the partprobe command to sync the changes
[root@rhel7 ~]# partprobe
[root@rhel7 ~]# fdisk -l
Disk /dev/sda: 128.8 GB, 128849018880 bytes, 251658240 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: 0x000b49f1
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2050047 1024000 83 Linux
/dev/sda2 2050048 100370431 49160192 8e Linux LVM
/dev/sda3 100370432 184256511 41943040 5 Extended
Disk /dev/mapper/rhel-root: 41.9 GB, 41943040000 bytes, 81920000 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/rhel-swap: 8388 MB, 8388608000 bytes, 16384000 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@rhel7 ~]# vgdisplay
--- Volume group ---
VG Name rhel
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 3
Act PV 3
VG Size 86.87 GiB
PE Size 4.00 MiB
Total PE 22239
Alloc PE / Size 12000 / 46.88 GiB
Free PE / Size 10239 / 40.00 GiB
VG UUID NvVNw2-XR30-7oS3-eGkz-81ZP-YziW-G238Kw
Step 3: Expand the logical volume to use the new space
[root@rhel7 ~]# lvdisplay
--- Logical volume ---
LV Path /dev/rhel/root
LV Name root
VG Name rhel
LV UUID QibbKI-Hu0u-5I16-nYhe-VRXI-a14N-JgyX8N
LV Write Access read/write
LV Creation host, time localhost, 2020-03-28 20:23:37 +0530
LV Status available
# open 1
LV Size 39.06 GiB
Current LE 10000
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
--- Logical volume ---
LV Path /dev/rhel/swap
LV Name swap
VG Name rhel
LV UUID ATHN2H-ycQ6-Z0az-pkxp-jCvF-2JBd-OWs7KG
LV Write Access read/write
LV Creation host, time localhost, 2020-03-28 20:23:37 +0530
LV Status available
# open 2
LV Size 7.81 GiB
Current LE 2000
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
[root@rhel7 ~]# lvextend -L+30G /dev/rhel/root
Extending logical volume root to 69.06 GiB
Logical volume root successfully resized
[root@rhel7 ~]# lvextend -L+8G /dev/rhel/root
Extending logical volume root to 77.06 GiB
Logical volume root successfully resized
# I ran into an issue with below command, the fix for that is given below,
# this is step 4 Step 4: Update the filesystem to use the new space
[root@rhel7 ~]# resize2fs /dev/rhel/root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/rhel/root
Couldn't find valid filesystem superblock.
Check the space is still low :
[root@rhel7 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 40G 37G 2.4G 95% /
devtmpfs 6.0G 0 6.0G 0% /dev
tmpfs 6.0G 148K 6.0G 1% /dev/shm
tmpfs 6.0G 8.9M 6.0G 1% /run
tmpfs 6.0G 0 6.0G 0% /sys/fs/cgroup
/dev/sda1 997M 126M 872M 13% /boot
[root@rhel7 ~]# xfs_growfs /dev/rhel/root
meta-data=/dev/mapper/rhel-root isize=256 agcount=4, agsize=2560000 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0
data = bsize=4096 blocks=10240000, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=5000, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 10240000 to 20201472
# Now check the space, its 78 GB now
[root@rhel7 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 78G 37G 41G 48% /
devtmpfs 6.0G 0 6.0G 0% /dev
tmpfs 6.0G 148K 6.0G 1% /dev/shm
tmpfs 6.0G 8.9M 6.0G 1% /run
tmpfs 6.0G 0 6.0G 0% /sys/fs/cgroup
/dev/sda1 997M 126M 872M 13% /boot
1. Present a new physical disk to the server
2. Adding the new physical disk to an exisiting Volume Group.
3. Expanding a logical volume within that Volume Group to use the new disk space.
4. Notify the operating system about the change in size.
[oracle@rhel7 ~]$ su -
Password:
Last login: Sat Mar 28 21:11:53 IST 2020 on pts/3
[root@rhel7 ~]# fdisk -l
Disk /dev/sda: 128.8 GB, 128849018880 bytes, 251658240 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: 0x000b49f1
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2050047 1024000 83 Linux
/dev/sda2 2050048 100370431 49160192 8e Linux LVM
Disk /dev/mapper/rhel-root: 41.9 GB, 41943040000 bytes, 81920000 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/rhel-swap: 8388 MB, 8388608000 bytes, 16384000 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
Step 1: Present the new physical disk to the server.
And Step 2: Add the new physical disk to an existing Volume Group.
[root@rhel7 ~]# fdisk /dev/sda
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.
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): e
Partition number (3,4, default 3):
First sector (100370432-251658239, default 100370432):
Using default value 100370432
Last sector, +sectors or +size{K,M,G} (100370432-251658239, default 251658239): +40G
Partition 3 of type Extended and of size 40 GiB is set
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
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 or after you run partprobe(8) or kpartx(8)
Syncing disks.
# Now run the partprobe command to sync the changes
[root@rhel7 ~]# partprobe
[root@rhel7 ~]# fdisk -l
Disk /dev/sda: 128.8 GB, 128849018880 bytes, 251658240 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: 0x000b49f1
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2050047 1024000 83 Linux
/dev/sda2 2050048 100370431 49160192 8e Linux LVM
/dev/sda3 100370432 184256511 41943040 5 Extended
Disk /dev/mapper/rhel-root: 41.9 GB, 41943040000 bytes, 81920000 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/rhel-swap: 8388 MB, 8388608000 bytes, 16384000 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@rhel7 ~]# vgdisplay
--- Volume group ---
VG Name rhel
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 3
Act PV 3
VG Size 86.87 GiB
PE Size 4.00 MiB
Total PE 22239
Alloc PE / Size 12000 / 46.88 GiB
Free PE / Size 10239 / 40.00 GiB
VG UUID NvVNw2-XR30-7oS3-eGkz-81ZP-YziW-G238Kw
Step 3: Expand the logical volume to use the new space
[root@rhel7 ~]# lvdisplay
--- Logical volume ---
LV Path /dev/rhel/root
LV Name root
VG Name rhel
LV UUID QibbKI-Hu0u-5I16-nYhe-VRXI-a14N-JgyX8N
LV Write Access read/write
LV Creation host, time localhost, 2020-03-28 20:23:37 +0530
LV Status available
# open 1
LV Size 39.06 GiB
Current LE 10000
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
--- Logical volume ---
LV Path /dev/rhel/swap
LV Name swap
VG Name rhel
LV UUID ATHN2H-ycQ6-Z0az-pkxp-jCvF-2JBd-OWs7KG
LV Write Access read/write
LV Creation host, time localhost, 2020-03-28 20:23:37 +0530
LV Status available
# open 2
LV Size 7.81 GiB
Current LE 2000
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
[root@rhel7 ~]# lvextend -L+30G /dev/rhel/root
Extending logical volume root to 69.06 GiB
Logical volume root successfully resized
[root@rhel7 ~]# lvextend -L+8G /dev/rhel/root
Extending logical volume root to 77.06 GiB
Logical volume root successfully resized
# I ran into an issue with below command, the fix for that is given below,
# this is step 4 Step 4: Update the filesystem to use the new space
[root@rhel7 ~]# resize2fs /dev/rhel/root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/rhel/root
Couldn't find valid filesystem superblock.
Check the space is still low :
[root@rhel7 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 40G 37G 2.4G 95% /
devtmpfs 6.0G 0 6.0G 0% /dev
tmpfs 6.0G 148K 6.0G 1% /dev/shm
tmpfs 6.0G 8.9M 6.0G 1% /run
tmpfs 6.0G 0 6.0G 0% /sys/fs/cgroup
/dev/sda1 997M 126M 872M 13% /boot
[root@rhel7 ~]# xfs_growfs /dev/rhel/root
meta-data=/dev/mapper/rhel-root isize=256 agcount=4, agsize=2560000 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0
data = bsize=4096 blocks=10240000, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=5000, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 10240000 to 20201472
# Now check the space, its 78 GB now
[root@rhel7 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 78G 37G 41G 48% /
devtmpfs 6.0G 0 6.0G 0% /dev
tmpfs 6.0G 148K 6.0G 1% /dev/shm
tmpfs 6.0G 8.9M 6.0G 1% /run
tmpfs 6.0G 0 6.0G 0% /sys/fs/cgroup
/dev/sda1 997M 126M 872M 13% /boot
No comments:
Post a Comment