银河麒麟V10 请问我的磁盘空间都在vda2上面,怎么把容量分给根目录。
[root@tangtang tmp]# fdisk /dev/vda
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): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p):
Using default response p
Partition number (3,4, default 3):
First sector (20971520-209715199, default 20971520):
Using default value 20971520
Last sector, +sectors or +size{K,M,G} (20971520-209715199, default 209715199): +10G
Partition 3 of type Linux and of size 10 GiB is set
Command (m for help): t
Partition number (1-3, default 3): 3
Hex code (type L to list all codes): L
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
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.
要将磁盘空间从vda2分配给根目录,可以通过以下步骤来实现:
fdisk /dev/vda
命令来进入fdisk交互界面。n
命令创建一个新的分区。p
(primary)。t
命令修改分区类型为 Linux LVM
。使用 w
命令保存并退出fdisk。
扩展LVM卷组的大小:使用 pvcreate /dev/vda3
命令将新创建的分区 /dev/vda3 加入到LVM物理卷中。
运行 pvcreate /dev/vda3
命令创建物理卷。
扩展LVM逻辑卷的大小:使用 vgextend VG名称 /dev/vda3
命令将新创建的物理卷 /dev/vda3 加入到卷组中。
替换 VG名称
为实际的卷组名称。
调整逻辑卷的大小:使用 lvextend -l +100%FREE LV名称
命令将逻辑卷的大小调整为卷组中可用空间的百分之百。
替换 LV名称
为实际的逻辑卷名称。
调整文件系统的大小:使用 resize2fs /dev/VG名称/LV名称
命令调整文件系统的大小以适应逻辑卷的新大小。
VG名称
和 LV名称
为实际的卷组和逻辑卷名称。以下是整个过程的示例代码:
1. 扩展vda2分区的大小:
# fdisk /dev/vda
(n 创建新分区)
(p 选择主分区)
(选择分区编号)
(设置起始扇区,默认即可)
(设置分区大小,例如+10G表示增加10GB)
(t 修改分区类型)
(选择分区编号)
(输入8e以将分区类型修改为Linux LVM)
(w 保存并退出fdisk)
2. 扩展LVM卷组的大小:
# pvcreate /dev/vda3
3. 扩展LVM逻辑卷的大小:
# vgextend VG名称 /dev/vda3
(替换VG名称为实际的卷组名称)
4. 调整逻辑卷的大小:
# lvextend -l +100%FREE LV名称
(替换LV名称为实际的逻辑卷名称)
5. 调整文件系统的大小:
# resize2fs /dev/VG名称/LV名称
(替换VG名称和LV名称为实际的卷组和逻辑卷名称)
请注意在使用上述命令时需谨慎操作,并备份重要的数据。如果你不熟悉LVM操作,建议在进行任何操作之前先进行充分的了解。如果你没有把握应对该问题,请不要尝试,以免造成数据丢失或系统崩溃。
不可以直接用虚拟机软件,若vmvare或者vittualbox直接手动扩容磁盘大小,磁盘变大了,它对应的根目录的容量也会变大的
你那张的意思是vda有150G总空间,1G为/boot分区,149G全是lvm,lvm上有17G是根分区的,2G是交换分区,149-2=147G,根分区可以由17G谈到147G,147-17=130G
localhost:~ # lvm
lvm> help
lvm> help lvextend
lvm> lvextend -L +130G /dev/....../klas-root
lvm> quit
Exiting.
如果根分区是ext4文件系统,要使用resize2fs扩展容量
localhost:~ # resize2fs /dev/....../klas-root
还有vdb也有150G空间要pvcreate再lvextend加到根分区,具体步骤要上机操作才行
请问具体要怎么操作,小白不是很看得懂,有真机不会操作。