Thursday, November 22, 2018

Extend file system when max primary partition limit reached on Linux.

Extend file system when max primary partition limit reached on Linux.

Example

VG01- /dev/sdb    // sdb having  4 Primary partition.
   -/dev/sdb1
   -/dev/sdb2
   -/dev/sdb3
   -/dev/sdb4

Now VG01 having FS /oracle/log of size 500GB and Linux admin want it to increase by 100GB.
But on VG01 there is no free space available , so admin decided to expand existing disk /dev/sdb.
After analysis found that /dev/sdb already having 4 primary partition and we cant create 5th primary partition.

Why existing disk expand is not possible?
answer to this query if on existing disk  Linux admin already created 4 primary partition so now creation of 5th primary partition is not possible. Linux will not allow creation of 5 primary partition on single disk.

Solution to this situation is add new disk to Virtual machine and create required partition on it and create PV and add it to volume group where FS reside. So after adding PV to volume group VG01 total free space in VG01 will be 100 GB . Now Linux admin can add 100 GB to /oracle/log.

How to detect new disk on suse linux ?

Run command rescan-scsi-bus.sh , this add scsi devices to Linux virtual machine without reboot.
take lssci before and after running rescan-scsi-bus.sh. find difference and it will show new disk.

Output of lsscsi before running rescan-scsi-bus.sh
#lsscsi
[0:0:0:0]    disk    VMware   Virtual disk     1.0   /dev/sda

[0:0:1:0]    disk    VMware   Virtual disk     1.0   /dev/sdb

After running rescan-scsi-bus.sh

#lsscsi
 [0:0:0:0]    disk    VMware   Virtual disk     1.0   /dev/sda
 [0:0:1:0]    disk    VMware   Virtual disk     1.0   /dev/sdb    
 [0:0:2:0]    disk    VMware   Virtual disk     1.0   /dev/sdc       // /dev/sdc is new disk .
After create required size partition and add it to VG01 and expand FS.


#lvextend -L +100G /dev/mapper/VG01-lvora_log
#lvs    

#resize2fs /dev/mapper/VG01-lvora_log   //resizing EXT3 Filesystem

Check using df -hT /oracle/log whether FS is resized or 

command for resizing XFS file system.

#xfs_growfs /dev/mapper/VG01-lvora_log

Extended partition  is solution to overcome max 4 primary partition but if Linux environment where creation of extended partition is not allowed then this approach is useful.





Thanks !!!!



No comments:

Post a Comment