I inherited managing a Centos 7 server where I am frequently running out of space in the root directory because its size is only 20Gb as shown bvelow.
df -h (excerpt)
/dev/sdb2 20G 15G 5.4G 74% /
/dev/sdb5 90G 25G 66G 28% /home
/dev/sdb1 497M 212M 286M 43% /boot
What would be the safest and easiest way to expand this partition? Listed below is the partition table for /dev/sdb.
Device Boot Start End Blocks Id System
sdb1 * 2048 1026047 512000 83 Linux
sdb2 1026048 42969087 20971520 83 Linux
sdb3 42969088 59746303 8388608 82 Linux swap / Solaris
sdb4 59746304 247463935 93858816 5 Extended
sdb5 59748352 247463935 93857792 83 Linux
My thought is to move the /home directory to a logical partition on /dev/sda (different drive) which would free up space on /dev/sdb. Could I then on /dev/sdb:
- Delete partitions sdb3, sdb4 & sdb 5
- Extend partition sdb2 while preserving its content
- Recreate a new swap partition
Here are all of my partitions:
lsblk
sdb 8:16 0 118G 0 disk
├─sdb1 8:17 0 500M 0 part /boot
├─sdb2 8:18 0 20G 0 part /
├─sdb3 8:19 0 8G 0 part [SWAP]
├─sdb4 8:20 0 1K 0 part
└─sdb5 8:21 0 89.5G 0 part /home
sda 8:0 0 5.5T 0 disk
└─sda1 8:1 0 5.5T 0 part
├─VG_part_1 252:0 0 2.2T 0 lvm /var/lib/app
├─VG_part_2 252:1 0 250G 0 lvm /var/log
└─VG_part_3 252:3 0 100G 0 lvm /data