Chinaunix首页 | 论坛 | 博客
  • 博客访问: 475763
  • 博文数量: 122
  • 博客积分: 1403
  • 博客等级: 中尉
  • 技术积分: 1668
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-11 13:31
文章分类

全部博文(122)

文章存档

2018年(5)

2017年(12)

2014年(15)

2013年(33)

2012年(4)

2011年(53)

分类: 系统运维

2013-05-16 15:55:54

[root@localhost ~]# df –h(查看分区状况)

文件系统          容量  已用  可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
                      154G  7.9G  139G   6% /
tmpfs                 1.9G  100K  1.9G   1% /dev/shm
/dev/sda1             485M   69M  391M  15% /boot
/dev/mapper/VolGroup-lv_home

                      299G  984M  283G   1% /home

因为我们想缩小/home,先卸载/home

[root@localhost ~]# umount /home(卸载/home
[root@localhost ~]# e2fsck -f /dev/mapper/VolGroup-lv_home(
检查VolGroup-lv_home文件的错误性,-f   即使文件系统没有错误迹象,仍强制地检查正确性。)
e2fsck 1.41.12 (17-May-2010)
第一步: 检查inode,,和大小
第二步: 检查目录结构
3: 检查目录连接性
Pass 4: Checking reference counts
5: 检查簇概要信息
/dev/mapper/VolGroup-lv_home: 21/19857408 files (0.0% non-contiguous), 1498180/79429632 blocks

因为/home仅仅装了系统,所以不需要太多空间,我们决定调整到很小:

[root@localhost ~]# resize2fs -p /dev/mapper/VolGroup-lv_home 20G(调整mapper/VolGroup-lv_home文件大小为20G

resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/VolGroup-lv_home to 5242880 (4k) blocks.
Begin pass 2 (max = 32778)
正在重定位块            XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 2424)
正在扫描inode          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 4 (max = 10)
正在更新inode引用       XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/mapper/VolGroup-lv_home is now 5242880 blocks long.

[root@localhost ~]# mount /home
(挂在 /home
[root@localhost ~]# df –h (
查看分区状况)
文件系统          容量  已用  可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
                      154G  7.9G  139G   6% /
tmpfs                 1.9G  100K  1.9G   1% /dev/shm
/dev/sda1             485M   69M  391M  15% /boot
/dev/mapper/VolGroup-lv_home
                       20G  962M   18G   6% /home
[root@localhost ~]# lvreduce -L 20G /dev/mapper/VolGroup-lv_home (lvreduce
指令用于减少LVM逻辑卷占用的空间大小。可能会删除逻辑卷上已有的数据,所以在操作前必须进行确认。)
  WARNING: Reducing active and open logical volume to 20.00 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_home? [y/n]: y
  Reducing logical volume lv_home to 20.00 GiB
  Logical volume lv_home successfully resized
[root@localhost ~]# df –h (
查看分区状况)
文件系统          容量  已用  可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
                      154G  7.9G  139G   6% /
tmpfs                 1.9G  100K  1.9G   1% /dev/shm
/dev/sda1             485M   69M  391M  15% /boot
/dev/mapper/VolGroup-lv_home
                       20G  962M   18G   6% /home
[root@localhost ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  7
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               465.27 GiB
  PE Size               4.00 MiB
  Total PE              119109
  Alloc PE / Size       46660 / 182.27 GiB
  Free  PE / Size       72449 / 283.00 GiB
  VG UUID               gPA8XS-ZncK-mGQj-2Vn9-TFTQ-6yOU-6atjE9
   
[root@localhost ~]# lvextend -L +283G /dev/mapper/VolGroup-lv_root (lvextend
指令:扩展逻辑卷空间)
  Extending logical volume lv_root to 439.39 GiB
  Logical volume lv_root successfully resized
[root@localhost ~]# resize2fs -p /dev/mapper/VolGroup-lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/VolGroup-lv_root is mounted on /; on-line resizing required
old desc_blocks = 10, new_desc_blocks = 28
Performing an on-line resize of /dev/mapper/VolGroup-lv_root to 115183616 (4k) blocks.
The filesystem on /dev/mapper/VolGroup-lv_root is now 115183616 blocks long.

 

现在检查一下调整的结果:

[root@localhost ~]# df -h
文件系统          容量  已用  可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
                      433G  7.9G  403G   2% /
tmpfs                 1.9G  100K  1.9G   1% /dev/shm
/dev/sda1             485M   69M  391M  15% /boot
/dev/mapper/VolGroup-lv_home
                       20G  962M   18G   6% /home

阅读(770) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~