linux xfs文件系统磁盘空间lv扩展


本文主要介绍关于linux,xfs的知识点,对【linux xfs文件系统磁盘空间lv扩展】和【】有兴趣的朋友可以看下由【DBA狗剩儿】投稿的技术文章,希望该技术和经验能帮到你解决你所遇的运维日常相关技术问题。

文章目录 前言一、明确文件系统类型二、注意事项1.取消nfs的挂载2.确定是否有free空间3.缩小大空间目录4.为xfs文件系统 /u01 进行扩展5.为xfs文件系统 / 进行扩展


前言

很多童鞋在运维工作中可能会遇到为某个目录去进行空间的扩展,但是针对不同的文件系统类型操作方法也有些不同,本文章就给大家介绍下xfs文件系统的空间扩展方法。


提示:以下是本篇文章正文内容,下面案例可供参考

一、明确文件系统类型
[root@cxldbadm01 /]# cat /etc/fstab
LABEL=DBSYS             /                       xfs    defaults        0 0
LABEL=BOOT              /boot                   xfs    defaults,nodev        0 0
LABEL=DBORA             /u01                    xfs    defaults,nodev 0 0
tmpfs                   /dev/shm                tmpfs   defaults,size=385247m 0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP              swap                    swap    defaults        0 0
LABEL=VAR               /var                    xfs    defaults        0 0
LABEL=DIAG              /var/log                xfs    defaults        0 0
LABEL=AUDIT             /var/log/audit          xfs    defaults        0 0
LABEL=TMP               /tmp                    xfs    defaults        0 0
LABEL=HOME              /home                   xfs    defaults        0 0
/dev/sda2		/boot/efi		vfat	defaults,nodev	1 2
efivars		/sys/firmware/efi/efivars		efivarfs	defaults	0 0
二、注意事项

空间扩展思路:如果有free空间直接可以进行空间扩展,否则需要将大目录缩小后,将缩小的空间加到要扩展的目录上。

1.取消nfs的挂载
[root@cxldbadm01 /]# cat /etc/exports
/xtts *(rw,sync,no_root_squash,no_all_squash,no_subtree_check)
/acfs *(rw,sync,no_root_squash,no_all_squash,no_subtree_check)
[root@cxldbadm01 /]# vi /etc/exports
"/etc/exports" 2L, 126C/xtts *(rw,sync,no_root_squash,no_all_squash,no_subtree_check)
/acfs *(rw,sync,no_root_squash,no_all_squash,no_subtree_check)
~                                                                                                                                                                                                                                                                          -- INSERT --#/xtts *(rw,sync,no_root_squash,no_all_squash,no_subtree_check)
#:wq!
"/etc/exports" 2L, 127C written

[root@cxldbadm01 /]# exportfs -a
[root@cxldbadm01 /]# df -h
Filesystem                           Size  Used Avail Use% Mounted on
devtmpfs                             189G     0  189G   0% /dev
tmpfs                                377G  2.0G  375G   1% /dev/shm
tmpfs                                189G  6.1M  189G   1% /run
tmpfs                                189G     0  189G   0% /sys/fs/cgroup
/dev/mapper/VGExaDb-LVDbSys1          15G   11G  4.1G  73% /
/dev/sda1                            510M   80M  431M  16% /boot
/dev/sda2                            254M  8.5M  246M   4% /boot/efi
/dev/mapper/VGExaDb-LVDbHome         4.0G   33M  4.0G   1% /home
/dev/mapper/VGExaDb-LVDbVar1         2.0G  200M  1.8G  10% /var
/dev/mapper/VGExaDb-LVDbVarLog        18G  1.9G   17G  11% /var/log
/dev/mapper/VGExaDb-LVDbTmp          3.0G   40M  3.0G   2% /tmp
/dev/mapper/VGExaDb-lvbackup         3.1T   34M  3.1T   1% /xtts
/dev/mapper/VGExaDb-LVDbOra1         100G   56G   45G  56% /u01
/dev/mapper/VGExaDb-LVDbVarLogAudit 1014M  156M  859M  16% /var/log/audit
tmpfs                                 38G     0   38G   0% /run/user/0
/dev/asm/volacfs-12                  8.0T   17G  8.0T   1% /acfs
[root@cxldbadm01 /]# umount /xtts
[root@cxldbadm01 /]# df -h
Filesystem                           Size  Used Avail Use% Mounted on
devtmpfs                             189G     0  189G   0% /dev
tmpfs                                377G  2.0G  375G   1% /dev/shm
tmpfs                                189G  6.1M  189G   1% /run
tmpfs                                189G     0  189G   0% /sys/fs/cgroup
/dev/mapper/VGExaDb-LVDbSys1          15G   11G  4.1G  73% /
/dev/sda1                            510M   80M  431M  16% /boot
/dev/sda2                            254M  8.5M  246M   4% /boot/efi
/dev/mapper/VGExaDb-LVDbHome         4.0G   33M  4.0G   1% /home
/dev/mapper/VGExaDb-LVDbVar1         2.0G  200M  1.8G  10% /var
/dev/mapper/VGExaDb-LVDbVarLog        18G  1.9G   17G  11% /var/log
/dev/mapper/VGExaDb-LVDbTmp          3.0G   40M  3.0G   2% /tmp
/dev/mapper/VGExaDb-LVDbOra1         100G   56G   45G  56% /u01
/dev/mapper/VGExaDb-LVDbVarLogAudit 1014M  156M  859M  16% /var/log/audit
tmpfs                                 38G     0   38G   0% /run/user/0
/dev/asm/volacfs-12                  8.0T   17G  8.0T   1% /acfs
2.确定是否有free空间
[root@cxldbadm01 /]# vgs
  VG      #PV #LV #SN Attr VSize VFree
  VGExaDb   1  14   0 wz--n- 3.27t    0 
3.缩小大空间目录

在缩小目录空间的时候,需要注意在目录有文件的情况下xfs文件系统无法直接缩小,需要将文件目录腾空后才可缩小。

[root@cxldbadm01 /]# lvs
  LV                      VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  LVDbHome                VGExaDb -wi-ao----   4.00g                                                    
  LVDbOra1                VGExaDb -wi-ao---- 100.00g                                                    
  LVDbSwap1               VGExaDb -wi-ao----  16.00g                                                    
  LVDbSys1                VGExaDb -wi-ao----  15.00g                                                    
  LVDbSys2                VGExaDb -wi-a-----  15.00g                                                    
  LVDbTmp                 VGExaDb -wi-ao----   3.00g                                                    
  LVDbVar1                VGExaDb -wi-ao----   2.00g                                                    
  LVDbVar2                VGExaDb -wi-a-----   2.00g                                                    
  LVDbVarLog              VGExaDb -wi-ao----  18.00g                                                    
  LVDbVarLogAudit         VGExaDb -wi-ao----   1.00g                                                    
  LVDbVdXWYYDBADM01DATAC1 VGExaDb -wi-ao---- 128.00m                                                    
  LVDbVdXWYYDBADM01RECOC1 VGExaDb -wi-ao---- 128.00m                                                    
  LVDoNotRemoveOrUse      VGExaDb -wi-a-----   2.00g                                                    
  lvbackup                VGExaDb -wi-a-----  <3.10t                                                    
[root@cxldbadm01 /]# lvreduce -L -2048G /dev/VGExaDb/lvbackup
  WARNING: Reducing active logical volume to <1.10 TiB.
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce VGExaDb/lvbackup? [y/n]: y
  Size of logical volume VGExaDb/lvbackup changed from <3.10 TiB (811766 extents) to <1.10 TiB (287478 extents).
  Logical volume VGExaDb/lvbackup successfully resized.
[root@cxldbadm01 /]# vgs
  VG      #PV #LV #SN Attr VSize VFree
  VGExaDb   1  14   0 wz--n- 3.27t 2.00t
4.为xfs文件系统 /u01 进行扩展
[root@cxldbadm01 /]# lvscan
  ACTIVE            '/dev/VGExaDb/LVDbTmp' [3.00 GiB] inherit
  ACTIVE            '/dev/VGExaDb/LVDbVarLog' [18.00 GiB] inherit
  ACTIVE            '/dev/VGExaDb/LVDbSys2' [15.00 GiB] inherit
  ACTIVE            '/dev/VGExaDb/LVDbVar1' [2.00 GiB] inherit
  ACTIVE            '/dev/VGExaDb/LVDbSwap1' [16.00 GiB] inherit
  ACTIVE            '/dev/VGExaDb/LVDbHome' [4.00 GiB] inherit
  ACTIVE            '/dev/VGExaDb/LVDbSys1' [15.00 GiB] inherit
  ACTIVE            '/dev/VGExaDb/LVDbVar2' [2.00 GiB] inherit
  ACTIVE            '/dev/VGExaDb/LVDbOra1' [100.00 GiB] inherit
  ACTIVE            '/dev/VGExaDb/LVDoNotRemoveOrUse' [2.00 GiB] inherit
  ACTIVE            '/dev/VGExaDb/LVDbVarLogAudit' [1.00 GiB] inherit
  ACTIVE            '/dev/VGExaDb/LVDbVdXWYYDBADM01DATAC1' [128.00 MiB] inherit
  ACTIVE            '/dev/VGExaDb/LVDbVdXWYYDBADM01RECOC1' [128.00 MiB] inherit
  ACTIVE            '/dev/VGExaDb/lvbackup' [<1.10 TiB] inherit
[root@cxldbadm01 /]# lvdisplay|grep lv
  LV Path                /dev/VGExaDb/lvbackup
  LV Name                lvbackup
[root@cxldbadm01 /]# lvresize -L +300G /dev/VGExaDb/LVDbOra1
  Size of logical volume VGExaDb/LVDbOra1 changed from 100.00 GiB (25600 extents) to 400.00 GiB (102400 extents).
  Logical volume VGExaDb/LVDbOra1 successfully resized.
[root@cxldbadm01 /]# xfs_growfs /u01
meta-data=/dev/mapper/VGExaDb-LVDbOra1 isize=256    agcount=16, agsize=1638400 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0 spinodes=0 rmapbt=0
         =                       reflink=0
data     =                       bsize=4096   blocks=26214400, imaxpct=25
         =                       sunit=256    swidth=256 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=12800, version=2
         =                       sectsz=512   sunit=8 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 26214400 to 104857600
[root@cxldbadm01 /]# df -h
Filesystem                           Size  Used Avail Use% Mounted on
devtmpfs                             189G     0  189G   0% /dev
tmpfs                                377G  2.0G  375G   1% /dev/shm
tmpfs                                189G  6.1M  189G   1% /run
tmpfs                                189G     0  189G   0% /sys/fs/cgroup
/dev/mapper/VGExaDb-LVDbSys1          15G   11G  4.1G  73% /
/dev/sda1                            510M   80M  431M  16% /boot
/dev/sda2                            254M  8.5M  246M   4% /boot/efi
/dev/mapper/VGExaDb-LVDbHome         4.0G   33M  4.0G   1% /home
/dev/mapper/VGExaDb-LVDbVar1         2.0G  200M  1.8G  10% /var
/dev/mapper/VGExaDb-LVDbVarLog        18G  1.9G   17G  11% /var/log
/dev/mapper/VGExaDb-LVDbTmp          3.0G   40M  3.0G   2% /tmp
/dev/mapper/VGExaDb-LVDbOra1         400G   56G  345G  14% /u01
/dev/mapper/VGExaDb-LVDbVarLogAudit 1014M  158M  857M  16% /var/log/audit
tmpfs                                 38G     0   38G   0% /run/user/0
/dev/asm/volacfs-12                  8.0T   17G  8.0T   1% /acfs
5.为xfs文件系统 / 进行扩展
[root@cxldbadm01 /]# lvresize -L +35G /dev/VGExaDb/LVDbSys1
  Size of logical volume VGExaDb/LVDbSys1 changed from 15.00 GiB (3840 extents) to 50.00 GiB (12800 extents).
  Logical volume VGExaDb/LVDbSys1 successfully resized.
[root@cxldbadm01 /]# df -h
Filesystem                           Size  Used Avail Use% Mounted on
devtmpfs                             189G     0  189G   0% /dev
tmpfs                                377G  2.0G  375G   1% /dev/shm
tmpfs                                189G  6.1M  189G   1% /run
tmpfs                                189G     0  189G   0% /sys/fs/cgroup
/dev/mapper/VGExaDb-LVDbSys1          15G   11G  4.1G  73% /
/dev/sda1                            510M   80M  431M  16% /boot
/dev/sda2                            254M  8.5M  246M   4% /boot/efi
/dev/mapper/VGExaDb-LVDbHome         4.0G   33M  4.0G   1% /home
/dev/mapper/VGExaDb-LVDbVar1         2.0G  200M  1.8G  10% /var
/dev/mapper/VGExaDb-LVDbVarLog        18G  1.9G   17G  11% /var/log
/dev/mapper/VGExaDb-LVDbTmp          3.0G   40M  3.0G   2% /tmp
/dev/mapper/VGExaDb-LVDbOra1         400G   56G  345G  14% /u01
/dev/mapper/VGExaDb-LVDbVarLogAudit 1014M  158M  857M  16% /var/log/audit
tmpfs                                 38G     0   38G   0% /run/user/0
/dev/asm/volacfs-12                  8.0T   17G  8.0T   1% /acfs
[root@cxldbadm01 /]# xfs_growfs /
meta-data=/dev/mapper/VGExaDb-LVDbSys1 isize=256    agcount=16, agsize=245760 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0 spinodes=0 rmapbt=0
         =                       reflink=0
data     =                       bsize=4096   blocks=3932160, imaxpct=25
         =                       sunit=256    swidth=256 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=8 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 3932160 to 13107200
[root@cxldbadm01 /]# df -h
Filesystem                           Size  Used Avail Use% Mounted on
devtmpfs                             189G     0  189G   0% /dev
tmpfs                                377G  2.0G  375G   1% /dev/shm
tmpfs                                189G  6.1M  189G   1% /run
tmpfs                                189G     0  189G   0% /sys/fs/cgroup
/dev/mapper/VGExaDb-LVDbSys1          50G   11G   40G  22% /
/dev/sda1                            510M   80M  431M  16% /boot
/dev/sda2                            254M  8.5M  246M   4% /boot/efi
/dev/mapper/VGExaDb-LVDbHome         4.0G   33M  4.0G   1% /home
/dev/mapper/VGExaDb-LVDbVar1         2.0G  200M  1.8G  10% /var
/dev/mapper/VGExaDb-LVDbVarLog        18G  1.9G   17G  11% /var/log
/dev/mapper/VGExaDb-LVDbTmp          3.0G   40M  3.0G   2% /tmp
/dev/mapper/VGExaDb-LVDbOra1         400G   56G  345G  14% /u01
/dev/mapper/VGExaDb-LVDbVarLogAudit 1014M  158M  857M  16% /var/log/audit
tmpfs                                 38G     0   38G   0% /run/user/0
/dev/asm/volacfs-12                  8.0T   17G  8.0T   1% /acfs

本文《linux xfs文件系统磁盘空间lv扩展》版权归DBA狗剩儿所有,引用linux xfs文件系统磁盘空间lv扩展需遵循CC 4.0 BY-SA版权协议。


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
  © 2014-2022 ITdaan.com 联系我们: