centos7 如何調整XFS格式的LVM大小,centos7調整xfslvm

來源:互聯網
上載者:User

centos7 如何調整XFS格式的LVM大小,centos7調整xfslvm

前提:XFS是centos7 預裝的作業系統,XFS只能擴大不能縮小,所以需要利用xfsdump / xfsrestore 工具在必須縮小lvm 的情況下,備份與還原資料。

本實驗的效果是:
1,/dev/mapper/centos-home僅僅保留500G;
2,將/home分出來的空間分給/dev/mapper/centos-root。
原始空間大小如示:

step1:安裝 xfsdump 套件
yum -y install xfsdump
step2:備份 /home
 xfsdump -f /home.xfsdump /homeplease enter label for this dump session (timeout in 300 sec)-> homeplease enter label for media in drive 0 (timeout in 300 sec)-> home
step3:縮減/dev/mapper/centos-home大小

卸載 /home

# umount /home

將 /home 的 Logical Volume 縮減為 5GB

# lvreduce -L 5G /dev/mapper/centos-homeDo you really want to reduce home? [y/n]: y
step4:增加/dev/mapper/centos-root的空間大小
# lvextend -l +100%FREE /dev/centos/root

延展 xfs 空間

# xfs_growfs /dev/centos/root
step5:恢複/home的內容

格式化 /home 的 lvm

# mkfs.xfs -f /dev/mapper/centos-home

掛載 /home /dev/mapper/centos-home

# mount /home

還原備份資料到 /home

# xfsrestore -f /home.xfsdump /home

調整過後的空間大小如示:

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.