专栏首页运维在线收缩和扩展LVM

在线收缩和扩展LVM

在安装系统时LVM的大小没有设定好,还好可以在线收缩和扩展。 1,看下各逻辑卷大小 [root@bogon ~]# df -h Filesystem            Size  Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00                        39G  461M   37G   2% / /dev/mapper/VolGroup00-LogVol03                        64G  222M   61G   1% /var /dev/mapper/VolGroup00-LogVol02                        49G  2.0G   45G   5% /usr /dev/mapper/VolGroup00-LogVol01                        39G  177M   37G   1% /home /dev/sda1              99M   13M   82M  14% /boot tmpfs                1005M     0 1005M   0% /dev/shm /dev/hdc              3.5G  3.5G     0 100% /media 2,看到home下有lost+found可见home分区单独挂载在一个分区下 [root@bogon ~]# ls /home/ innofidei  lost+found 3,卸载并验证 [root@bogon ~]# umount /dev/mapper/VolGroup00-LogVol01 [root@bogon ~]# ls /home/ 4,resize2fs  卷组先 [root@bogon ~]# resize2fs /dev/mapper/VolGroup00-LogVol01 20G resize2fs 1.39 (29-May-2006) Resizing the filesystem on /dev/mapper/VolGroup00-LogVol01 to 5242880 (4k) blocks. The filesystem on /dev/mapper/VolGroup00-LogVol01 is now 5242880 blocks long.

注意这里会提醒你e2fsck的 所以resize2fs之前要这样做: e2fsck -f /dev/mapper/VolGroup-logVol01

5,减小lvm [root@bogon ~]# lvreduce -L 20G /dev/mapper/VolGroup00-LogVol01   /dev/hdc: open failed: Read-only file system   WARNING: Reducing active logical volume to 20.00 GB   THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce LogVol01? [y/n]: y   Reducing logical volume LogVol01 to 20.00 GB   Logical volume LogVol01 successfully resized 6,重新挂载并验证 [root@bogon ~]# mount -a [root@bogon ~]# df -h Filesystem            Size  Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00                        39G  461M   37G   2% / /dev/mapper/VolGroup00-LogVol03                        64G  222M   61G   1% /var /dev/mapper/VolGroup00-LogVol02                        49G  2.0G   45G   5% /usr /dev/sda1              99M   13M   82M  14% /boot tmpfs                1005M     0 1005M   0% /dev/shm /dev/hdc              3.5G  3.5G     0 100% /media /dev/mapper/VolGroup00-LogVol01                        20G  173M   19G   1% /home [root@bogon ~]# ls /home/ innofidei  lost+found 7,扩展另一lvm [root@bogon ~]# lvextend -L +20G /dev/mapper/VolGroup00-LogVol02   /dev/hdc: open failed: Read-only file system   Extending logical volume LogVol02 to 70.00 GB   Logical volume LogVol02 successfully resized [root@bogon ~]# resize2fs /dev/mapper/VolGroup00-LogVol02 resize2fs 1.39 (29-May-2006) Filesystem at /dev/mapper/VolGroup00-LogVol02 is mounted on /usr; on-line resizing required Performing an on-line resize of /dev/mapper/VolGroup00-LogVol02 to 18350080 (4k) blocks. The filesystem on /dev/mapper/VolGroup00-LogVol02 is now 18350080 blocks long. 8,再验证 [root@bogon ~]# df -h Filesystem            Size  Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00                        39G  461M   37G   2% / /dev/mapper/VolGroup00-LogVol03                        64G  222M   61G   1% /var /dev/mapper/VolGroup00-LogVol02                        68G  2.0G   63G   4% /usr /dev/sda1              99M   13M   82M  14% /boot tmpfs                1005M     0 1005M   0% /dev/shm /dev/hdc              3.5G  3.5G     0 100% /media /dev/mapper/VolGroup00-LogVol01                        20G  173M   19G   1% /home

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 新增存储用Parted分区并建LVM卷

    Welcome to GNU Parted! Type 'help' to view a list of commands.

    三杯水Plus
  • Codis 3.2 部署配置汇总

    服务端:codis-fe------codis-dashboard------codis-proxy------codis-group------codis-s...

    三杯水Plus
  • 安装rhel6系统分区指导

    系统分区指导 1,Unless you have a reason for doing otherwise, we recommend that you cr...

    三杯水Plus
  • tty各种设备的情况

    通常使用tty来简称各种类型的终端设备。 (1)串口端口终端(/dev/ttySn)   串行端口终端(Serial Port Terminal)是使用计算机串...

    233333
  • nghttp2 - HTTP/2 C Library 简明教程(二)

    程序手艺人
  • 10.YOLO系列及如何训练自己的数据。

    SSD失败之后就挺失望的,而且莫名其妙,于是转向YOLO了,其实object detection领域可选的模型并不多,RCNN系列我是大概看过的,还写过:RCN...

    和蔼的zhxing
  • Ubuntu16.04安装Python3

    https://www.python.org/downloads/release/python-370/

    py3study
  • linux软raid制作记录

    domain0
  • mdadm软RAID的删除方法和注意事项 转

    domain0
  • mac电脑进行可见光通信实验要点

    俺踏月色而来

扫码关注云+社区

领取腾讯云代金券