标签:
[root@localhost ~]# vgdisplay
从下面的代码中发现剩余空间为0
--- Volume group --- VG Name rhel System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 7 VG Access read/write VG Status resizable MAX LV 0 Cur LV 4 Open LV 4 Max PV 0 Cur PV 2 Act PV 2 VG Size 25.00 GiB PE Size 4.00 MiB Total PE 6400 Alloc PE / Size 6400 / 25.00 GiB Free PE / Size 0 / 0 VG UUID PQijQV-gDsG-wnQT-rIGE-3rGa-hwpl-oYJ3E9
当卷组中没有足够的空间用于扩展逻辑卷的大小时,就需要增加卷组的容量,而增加卷组容量的唯一办法就是向卷组中添加新的物理卷
首先,查看挂载的硬盘
[root@localhost ~]# fdisk -l
从下面的代码知道,当前挂载了一个硬盘,名词为“/dev/sda”
Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
[root@localhost ~]# fdisk /dev/sda 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, 1 extended, 1 free) l logical (numbered from 5) Select (default p): l Adding logical partition 14 First sector (694638592-976769071, default 694638592): Using default value 694638592 Last sector, +sectors or +size{K,M,G} (694638592-743761304, default 743761304): +3G
Last sector, +sectors or +size{K,M,G} (694638592-743761304, default 743761304): +3G
Partition 14 of type Linux and of size 3 GiB is set
Command (m for help): w
参考网址:http://blog.chinaunix.net/uid-23929712-id-2650378.html
[root@localhost ~]# partprobe^C
首先用fdisk -l 可以知道新创建的分区名称为:/dev/sda13
之后用pvcreate命令创建物理卷
[root@localhost ~]# pvcreate /dev/sda13
[root@localhost ~]# vgextend rhel /dev/sda13
首先用vgdisplay命令检查当前卷组空间使用情况
Free PE / Size 768/ 3GB
确定当前卷组剩余空间3GB,剩余PE数量为768个。在这里将所有的剩余空间全部增加给逻辑卷rhel
root@localhost ~]# lvextend -l+768 /dev/rhel/root
[root@localhost ~]# xfs_growfs /dev/rhel/root
参考网址:http://www.jb51.net/LINUXjishu/242689.html
6.最后查看一下文件系统的当前状态
[root@localhost ~]# df -lh
Filesystem Size Used Avail Use% Mounted on /dev/mapper/rhel-root 11G 7.0G 4.1G 64% / devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 140K 1.9G 1% /dev/shm tmpfs 1.9G 9.0M 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/mapper/rhel-home 6.0G 2.1G 4.0G 35% /home /dev/mapper/rhel-var 6.0G 825M 5.2G 14% /var /dev/sda11 197M 92M 106M 47% /boot
关于LVM可以参考:http://baike.baidu.com/view/361916.htm
标签:
原文地址:http://www.cnblogs.com/haoyufeng/p/4439192.html