ext4文件系统可以进行扩缩容操作,但xfs的文件系统只能扩容,无法直接缩容
所以如果需要进行xfs的缩容,可以先使用xfsdump备份文件系统,然后对逻辑卷(/分区)进行缩容操作(此时原xfs文件系统会损坏),然后再重新格式化该逻辑卷(/分区),最后xfsrestore将备份还原到该逻辑卷(/分区)
当然,这需要先下载xfsdump工具
[root@localhost ~]# df -Th #查看文件系统磁盘使用情况
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 7.9G 07.9G 0% /dev
tmpfs tmpfs 7.9G 07.9G 0% /dev/shm
tmpfs tmpfs 7.9G 8.9M7.9G 1% /run
tmpfs tmpfs 7.9G 07.9G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 50G 3.0G 47G 6% /
/dev/sda2 xfs 1014M 131M 884M 13% /boot
/dev/sda1 vfat 200M 12M 189M 6% /boot/efi
/dev/mapper/centos-home xfs 64G 33M 64G 1% /home
tmpfs tmpfs 1.6G 01.6G 0% /run/user/0
###########################操作1:备份home分区文件系统################################
[root@localhost ~]# xfsdump -f ~/home.xfs_dump /home #备份文件系统
xfsdump: using file dump (drive_simple) strategy
xfsdump: version 3.1.7 (dump format 3.0) - type ^C for status and control
============================= dump label dialog ==============================
please enter label for this dump session (timeout in300 sec)
-> #自定义备份会话标签,可直接回车
session label entered: ""
--------------------------------- end dialog ---------------------------------
xfsdump: WARNING: no session label specified
xfsdump: level 0 dump of localhost.localdomain:/home
xfsdump: dump date: Wed Oct 2622:48:122022文章来源:https://www.toymoban.com/news/detail-519483.html
xfsdump: session id: e3f11041-db93-41db-954f-b1101edb7b42文章来源地址https://www.toymoban.com/news/detail-519483.html
到了这里,关于xfs文件系统扩缩容的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!