两大步:一、sda2扩容;二、sda3移到最后,重设交换分区
一、扩容
查看磁盘分区情况,sda2挂载在根目录下,新扩容增加的sda5挂在在/data下
[root@centos7 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 30G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 10G 0 part /
├─sda3 8:3 0 4G 0 part [SWAP]
├─sda4 8:4 0 1K 0 part
└─sda5 8:5 0 15G 0 part /data
sr0 11:0 1 4.4G 0 rom
现在想把sda5同样挂载在根目录下
解决方法:删除sda2,再重建sda2(注意:删除后不要退出,紧接着重建,注意重建后的起始位置)
删除sda2然后重建
fdisk /dev/sda
[root@centos7 ~]# 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): p
Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 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: 0x000a4420
Device Boot Start End Blocks Id System
/dev/sda1 *