linux – 将空间从一个卷移动到另一个卷

前端之家收集整理的这篇文章主要介绍了linux – 将空间从一个卷移动到另一个卷前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个设置/ 50G空间.我想为/增加空间.
[root@testsyst ~]# df -h
Filesystem                       Size  Used Avail Use% Mounted on
/dev/mapper/vg_testsyst-lv_root   50G   22G   26G  46% /
tmpfs                            127G     0  127G   0% /dev/shm
/dev/mapper/mpathap1             481M   40M  416M   9% /boot
/dev/mapper/vg_testsyst-lv_home  242G  188M  230G   1% /home

/ home有242G,从/ home我想将150G移动到/.

请参阅下面的lvmdisplay和vgdisplay的输出.

[root@testsyst ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg_testsyst/lv_root
  LV Name                lv_root
  VG Name                vg_testsyst
  LV UUID                VzQzcz-NssK-8BIT-qtjz-XJho-0Mwd-fEbph1
  LV Write Access        read/write
  LV Creation host,time testsyst,2014-05-01 23:51:39 +0530
  LV Status              available
  # open                 1
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3

  --- Logical volume ---
  LV Path                /dev/vg_testsyst/lv_home
  LV Name                lv_home
  VG Name                vg_testsyst
  LV UUID                zNUKiG-QouE-q71z-ohNQ-0cFR-lggG-jNksZd
  LV Write Access        read/write
  LV Creation host,2014-05-01 23:51:41 +0530
  LV Status              available
  # open                 1
  LV Size                245.50 GiB
  Current LE             62847
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:5

  --- Logical volume ---
  LV Path                /dev/vg_testsyst/lv_swap
  LV Name                lv_swap
  VG Name                vg_testsyst
  LV UUID                Nv191J-qMuf-zX7R-ifLV-76Et-V1Yp-LAkejt
  LV Write Access        read/write
  LV Creation host,2014-05-01 23:51:48 +0530
  LV Status              available
  # open                 1
  LV Size                4.00 GiB
  Current LE             1024
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:4

[root@testsyst ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_testsyst
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  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               299.50 GiB
  PE Size               4.00 MiB
  Total PE              76671
  Alloc PE / Size       76671 / 299.50 GiB
  Free  PE / Size       0 / 0
  VG UUID               eHqLTK-G941-Xy9V-Ga8X-0AZH-Ndf4-g5wtag

解决方法

>使用支持LVM的维护CD启动,例如 SystemRescueCD.
>打开root shell.
>减少/ home的大小:
lvreduce --resizefs --size -150G /dev/mapper/vg_testsyst-lv_home

–resizefs选项是必不可少的,可以在减小保存文件系统的卷的大小之前减小文件系统的大小.我相信该选项应适用于大多数常见文件系统,但如果没有,则必须首先减小文件系统的大小,例如,resize2fs用于ext2 / 3/4文件系统.

150 GB现已返回到vg_testsyst卷组.
>将额外空间添加到/:

lvextend --resizefs --size +150G /dev/mapper/vg_testsyst-lv_root

这次–resizefs将扩展文件系统的大小以等于新的卷大小.>重新启动.

原文链接:https://www.f2er.com/linux/399793.html

猜你在找的Linux相关文章