Tuesday, June 16, 2020

How To Resize Partition in RHEL 7

root@apollo dbapps]# fdisk /dev/sdc

The number of cylinders for this disk is set to 54827.
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/sdc: 450.9 GB, 450971566080 bytes
255 heads, 63 sectors/track, 54827 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       39162   314568733+  83  Linux

Command (m for help): d
Selected partition 1

Command (m for help): p

Disk /dev/sdc: 450.9 GB, 450971566080 bytes
255 heads, 63 sectors/track, 54827 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

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

Command (m for help): p

Disk /dev/sdc: 450.9 GB, 450971566080 bytes
255 heads, 63 sectors/track, 54827 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       54827   440397846   83  Linux

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


REBOOT

[root@apollo ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              16G  3.4G   12G  23% /
/dev/sda1             251M   17M  222M   7% /boot
tmpfs                 5.9G     0  5.9G   0% /dev/shm
/dev/sdc1             296G  245G   36G  88% /dbapps
[root@apollo ~]# resize2fs -p /dev/sdc1
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/sdc1 is mounted on /dbapps; on-line resizing required
Performing an on-line resize of /dev/sdc1 to 110099461 (4k) blocks.
The filesystem on /dev/sdc1 is now 110099461 blocks long.

[root@apollo ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              16G  3.4G   12G  23% /
/dev/sda1             251M   17M  222M   7% /boot
tmpfs                 5.9G     0  5.9G   0% /dev/shm
/dev/sdc1             414G  245G  148G  63% /dbapps
[root@apollo ~]#

No comments:

Post a Comment