[root@rac1 ~]# lvextend -L+9.98G /dev/vg_rac1/lv_root /dev/sda4
最后一步 使用 resize2fs 命令,用于扩大或者缩小未挂载的 ext2,ext3 或者是 ext4 文件系统。
文件系统空间已经扩展成功,如果 resize2fs 之后文件系统空间没增加可以尝试重启虚拟机。
f 命令查看自己的/目录属于哪个逻辑卷(我们要做的是对逻辑卷扩展)
[root@redhat6-3 ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_redhat63-lv_root
18102140 1298416 15884172 8% /
tmpfs 124592 0 124592 0% /dev/shm
/dev/sda1 495844 29859 440385 7% /boot
新加一块硬盘,我的是 sdb 先创建物理卷
[root@redhat6-3 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF
disklabel
Building a new DOS disklabel with disk identifier 0xce359e4e.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
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
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 1): (回车,默认将所有空间分配给第一个主分区)
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-261, default 261):
Using default value 261
Command (m for help): t(修改磁盘格式为 LVM)
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
再次查看磁盘情况
[root@redhat6-3 ~]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
评论