一.磁盘扩容
随后,开启此虚拟机
二.创建新的磁盘分区
fdisk -l --查看磁盘情况
如上所示,磁盘空间扩展为42.9GB
fdisk /dev/sdb --为/dev/sdb设备分区
我这里将原来的第四个分区删除,并重新创建以达到扩容目的:
[[email protected] ~]# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
You must delete some partition and add an extended partition first
Command (m for help): ^C
[[email protected] ~]# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): d
Partition number (1-4): 4
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First cylinder (2611-5221, default 2611):
Using default value 2611
Last cylinder, +cylinders or +size{K,M,G} (2611-5221, default 5221):
Using default value 5221
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.
mkdir /disk4 --创建挂载目录
由于我这里是扩容,先前 /disk4 目录已经创建好了
reboot --重启
mkfs.ext4 /dev/sda4 --格式化
三.挂载并设置自动挂载
mount /dev/sda4 /disk4/ --挂载
vi /etc/fstab --设置开机自动挂载
扩容成功!