我的任务是调整远程服务器上分区的大小。我已经阅读了相关内容,并了解到我需要卸载并使用resize2fs /dev/sda
来扩展分区大小。有人可以帮我卸载分区或指导我完成此操作吗?设置详情如下:
更新,磁盘空间现在为 200gb,但仍然需要帮助将分区扩展到其最大大小
fdisk -l
输出
Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00080e9a
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 2611 20458496 8e Linux LVM
Disk /dev/mapper/vg_livecd-lv_root: 18.8 GB, 18832424960 bytes
255 heads, 63 sectors/track, 2289 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_livecd-lv_root doesn't contain a valid partition table
Disk /dev/mapper/vg_livecd-lv_swap: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_livecd-lv_swap doesn't contain a valid partition table
和
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_livecd-lv_root
18G 2.8G 15G 17% /
tmpfs 1004M 0 1004M 0% /dev/shm
/dev/sda1 485M 33M 427M 8% /boot
答案1
在大多数情况下,您可以在线调整文件系统大小,无需将其卸载。
看起来您正在使用 LVM,因此从高层次来看您的步骤是:
- 向磁盘添加另一个 LVM 分区
- 将此分区作为物理卷添加到卷组
- 调整逻辑卷的大小
- 使用 resize2fs 将文件系统扩展到新的大小