缩小根分区

缩小根分区

如何缩小 VPS 上的根分区(无需卸载)。

df -h命令:

Filesystem              Size  Used Avail Use% Mounted on
udev                    485M     0  485M   0% /dev
tmpfs                   100M  7.9M   92M   8% /run
/dev/mapper/vg-lv_root   19G  1.2G   17G   7% /
tmpfs                   496M     0  496M   0% /dev/shm
tmpfs                   5.0M     0  5.0M   0% /run/lock
tmpfs                   496M     0  496M   0% /sys/fs/cgroup
/dev/sda1               236M   37M  187M  17% /boot
tmpfs                   100M     0  100M   0% /run/user/0

fdisk -l命令:

Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 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
Disklabel type: dos
Disk identifier: 0xdfc30638

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sda1           2048   499711   497664  243M 83 Linux
/dev/sda2         499712 20971519 20471808  9.8G 8e Linux LVM
/dev/sda3       20971520 41943039 20971520   10G 8e Linux LVM




Disk /dev/mapper/vg-lv_root: 18.8 GiB, 20136853504 bytes, 39329792 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 /dev/mapper/vg-lv_swap: 1 GiB, 1073741824 bytes, 2097152 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

我想从根分区创建 12 GB 的分区,然后根分区应该有 7 GB。

我知道我可能会丢失数据。

相关内容