因为根目录会包含很多系统应用运行的配置等,肯定不能直接卸载,所以要采用一种既不破坏数据,又能扩容的方法:
1.关机 2.设置->扩展磁盘容量 3.开机 [root@localhost ~]# df -hT -T 文件系统 Filesystem Type Size Used Avail Use% Mounted on /dev/sda2 ext4 18G 15G 2.6G 85% / tmpfs tmpfs 491M 148K 491M 1% /dev/shm /dev/sda1 ext4 291M 34M 242M 13% /boot
[root@localhost ~]# fdisk -l
Device Boot Start End Blocks Id System /dev/sda1 * 1 39 307200 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 39 2358 18631680 83 Linux 非LVM
[root@localhost ~]# fdisk /dev/sda d 删除分区 2 删除/dev/sda2 n 新增 p 主分区 2 新增/dev/sda2 回车 默认 回车 默认 w 保存 [root@localhost ~]# reboot 因为是ext4格式,用resize2fs
[root@localhost ~]# resize2fs /dev/sda2 resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/sda2 is mounted on /; on-line resizing required old desc_blocks = 2, new_desc_blocks = 3 Performing an on-line resize of /dev/sda2 to 10407364 (4k) blocks. The filesystem on /dev/sda2 is now 10407364 blocks long. [root@localhost ~]# df -hT Filesystem Type Size Used Avail Use% Mounted on /dev/sda2 ext4 40G 15G 24G 38% / tmpfs tmpfs 491M 80K 491M 1% /dev/shm /dev/sda1 ext4 291M 34M 242M 13% /boot .host:/ vmhgfs 921G 171G 751G 19% /mnt/hgfs [root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sr0 11:0 1 1024M 0 rom sda 8:0 0 40G 0 disk ├─sda1 8:1 0 300M 0 part /boot └─sda2 8:2 0 39.7G 0 part / 由于sda2挂载在根目录下,sda2是最后一个分区,所以新增的空间跟sda2是连续的,在最后选择start和end的时候,就能连接上,这也是成功的一个条件
|