Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
5挂载lv mount
mkdir -p /mnt/lv 在mnt目录下创建lv目录,留挂载用
mount /dev/myvg/testlv /mnt/lv
[root@localhost lv]# ll /mnt/lv ----->查看挂载点,看到lost+found 说明成功挂载
total 16
drwx------. 2 root root 16384 Mar 24 19:07 lost+found
6 查看挂载后的lv大小 df -lh
[root@localhost lv]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 18G 1.9G 15G 12% /
tmpfs 931M 0 931M 0% /dev/shm
/dev/sda1 485M 39M 421M 9% /boot
/dev/mapper/myvg-testlv 6.0G 12M 5.6G 1% /mnt/lv
8:lv的扩展
*1 扩展lv物理边界 ,先查看一下vg中是否有足够的可用空间
lvextend -L [+]#G /part/to/lv_name
注: 带+扩展#G 不带+表达扩展到#G
[root@localhost ~]# lvextend -L 10G /dev/myvg/testlv
Extending logical volume testlv to 10.00 GiB
Logical volume testlv successfully resized
(2)查看lv大小 lvs
Logical volume testlv successfully resized
[root@localhost lv]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
lv_root VolGroup -wi-ao---- 17.51g
lv_swap VolGroup -wi-ao---- 2.00g
testlv myvg -wi-ao---- 10.0 这是lv已经扩展到10G了。我们现在来看一下df -lh文件(3)系统中的lv大小
[root@localhost lv]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 18G 1.9G 15G 12% /
tmpfs 931M 0 931M 0% /dev/shm
/dev/sda1 485M 39M 421M 9% /boot
/dev/mapper/myvg-testlv 6.0G 12M 5.6G 1% /mnt/lv 这是文件系统中的lv还是6G没有变化,所有我们还要扩展lv的文件系统边界
*2 扩展lv的文件系统边界 (在redhat5上支持在线扩展,redhat6不支持。需要卸载挂载)
lvsize2fs /part/to/lv_name #G
-p 扩展到和物理边界一样大
先卸载挂载umount /dev/myvg/testlv
[root@localhost lv]# umount /dev/myvg/testlv
umount: /mnt/lv: device is busy.---->磁盘繁忙,不让我们卸载。
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
[root@localhost lv]# fuser -mk /dev/myvg/testlv---->把挂载点上的进程结束,可能会logout 重登
//dev/myvg/testlv: 2164c
再强行磁盘检查 e2fsck -f /dev/myvg/testlv
[root@localhost ~]# e2fsck -f /dev/myvg/testlv
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
最后扩展lv的文件系统边界 resize2fs /dev/myvg/testlv 10G
[root@localhost ~]# resize2fs /dev/myvg/testlv 10G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/myvg/testlv to 2621440 (4k) blocks.
The filesystem on /dev/myvg/testlv is now 2621440 blocks long.
重新挂载启动,mount /dve/myvg/testlv /mnt/lv
设置开机自动挂载 vi /etc/fstab 在里面添加一行