Linux 扩展LVM下的Volume Group、Logical Volume
来源:互联网 发布:云计算的好处有哪些 编辑:程序博客网 时间:2024/04/29 04:55
Linux 扩展LVM下的Volume Group、Logical Volume
通过扩展Volume Group、Logical Volume来达到扩展文件系统的大小,
我的服务器是建在虚机上的,
分配硬盘空间时,通过修改参数把原来硬盘加大的。
[root@localhost ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1044 8281507+ 8e Linux LVM
先创建物理分区
#fdisk /dev/sda
通n键,创建一个主分区;
通t键,输入8e转换为LVM分区
w键,写入分区表
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1044 8281507+ 8e Linux LVM
/dev/sda3 1045 3916 23069340 8e Linux LVM
重启生效,然后创建物理卷(physical volume)
#pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
查看现有的vg
#vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 7.88 GB
PE Size 32.00 MB
Total PE 252
Alloc PE / Size 250 / 7.81 GB
Free PE / Size 2 / 64.00 MB
VG UUID Zv74Nv-kqbn-SpF3-yBcg-brXn-2X0G-5mbJcx
通过vgextend命令扩展现有的vg
#vgextend VolGroup00 /dev/sda3
Volume group "VolGroup00" successfully extended
#vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 29.88 GB
PE Size 32.00 MB
Total PE 956
Alloc PE / Size 250 / 7.81 GB
Free PE / Size 706 / 22.06 GB
VG UUID Zv74Nv-kqbn-SpF3-yBcg-brXn-2X0G-5mbJcx
#mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
none on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
可以看到文件系统的 / 是挂载在/dev/mapper/VolGroup00-LogVol00上的,
因此,通过改变lv LogVol00的大小来达到给/增减空间的目的。
# lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [5.88 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [1.94 GB] inherit
通过lvresize命令扩展Logical Volume
# lvresize -L +22.06G /dev/VolGroup00/LogVol00
Rounding up size to full physical extent 22.06 GB
Extending logical volume LogVol00 to 27.94 GB
Logical volume LogVol00 successfully resized
调整完后,查看一下文件系统使用情况
#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.8G 3.5G 2.1G 63% /
/dev/sda1 99M 14M 81M 14% /boot
none 506M 0 506M 0% /dev/shm
发现并没有没发生改变
通过ext2online命令在线resize文件系统
#ext2online /dev/mapper/VolGroup00-LogVol00
#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
28G 3.5G 23G 14% /
/dev/sda1 99M 14M 81M 14% /boot
none 506M 0 506M 0% /dev/shm
大小调整成功!
mkfs.ext3 /dev/sda3
mount -t ext3 /dev/sda3 /usr
检查分区
#e2fsck /dev/VolGroup00/LogVol00
- Linux 扩展LVM下的Volume Group、Logical Volume
- Linux的LVM(Logical Volume Manager)
- Linux LVM(Logical Volume Manager)
- Linux LVM(Logical Volume Manager)
- LVM(Logical Volume Manager)
- LVM---Logical Volume Management
- LVM(Logical Volume Manager)
- LVM (Logical Volume Manager)的优势
- LVM (Logical Volume Management) 配置
- 理解 LVM (Logical Volume Manager)
- 理解 LVM (Logical Volume Manager)
- LVM2 Logical Volume Manager 详解(七)--LVM卷组Volume Group命令实战
- Linux 系统 LVM(Logical Volume Manager)逻辑卷管理
- 简单理解LVM(Logical Volume Manager)的基本原理
- LVM(Logical Volume Manager)的个人理解
- [转载]理解 LVM (Logical Volume Manager)
- LVM(logical volume management) 逻辑卷管理器
- LVM(Logical volume management,逻辑卷管理)
- {传智播客} (学习笔记)--eclipse插件引入方法
- avicap
- 条款01:视C++为一个语言联邦(View C++ as a federation of languages)
- Android Bluetooth 移植(下)
- 条款02:尽量以const, enum, inline替换#define(Prefer consts,enums, and inlines to #defines)
- Linux 扩展LVM下的Volume Group、Logical Volume
- android 调试中 addr2line 命令的使用
- c++ 数据范围
- windows内核安全编程笔记
- 经典进程同步问题
- QT4.5+tslib1.4配置arm-s3c2410触摸屏
- js判断不提交表单方法
- 工作的价值
- jqGrid与Struts2的结合应用(六) —— 使用colModel设置查询功能