xfs文件系统LV扩容

版本

[root@station mapper]# cat /proc/version
Linux version 3.10.0-123.el7.x86_64 (mockbuild@x86-017.build.eng.bos.redhat.com) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Mon May 5 11:16:57 EDT 2014
 

1、创建XFS_LV

[root@station mapper]# lvcreate -L 100M -n /dev/vo_vg/xfs_lv
  Logical volume "xfs_lv" created
[root@station mapper]# mkfs.xfs /dev/vo_vg/xfs_lv
meta-data=/dev/vo_vg/xfs_lv      isize=256    agcount=4, agsize=6400 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0
data     =                       bsize=4096   blocks=25600, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=853, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@station mapper]# 
[root@station mapper]# lvdisplay 

  --- Logical volume ---
  LV Path                /dev/vo_vg/vo_lv
  LV Name                vo_lv
  VG Name                vo_vg
  LV UUID                0nZkWe-Slw6-E6aa-TZic-1dJF-7JKm-NPrda1
  LV Write Access        read/write
  LV Creation host, time station.domain1.example.com, 2020-06-13 22:29:12 +0800
  LV Status              available
  # open                 1
  LV Size                300.00 MiB
  Current LE             75
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           252:1
   
  --- Logical volume ---
  LV Path                /dev/vo_vg/xfs_lv
  LV Name                xfs_lv
  VG Name                vo_vg
  LV UUID                Ev1buz-Y0Xy-afUk-VvzT-0OmP-1fxe-wL0SGj
  LV Write Access        read/write
  LV Creation host, time station.domain1.example.com, 2020-06-13 23:06:06 +0800
  LV Status              available
  # open                 0
  LV Size                100.00 MiB
  Current LE             25
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           252:2
 

[root@station mapper]# mkdir /xfs_lv
[root@station mapper]# mount /dev/vo_vg/xfs_lv /xfs_lv
[root@station mapper]# df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/vda1                  10G  3.3G  6.8G  33% /
devtmpfs                  906M     0  906M   0% /dev
tmpfs                     921M   84K  921M   1% /dev/shm
tmpfs                     921M   17M  904M   2% /run
tmpfs                     921M     0  921M   0% /sys/fs/cgroup
/dev/mapper/vo_vg-vo_lv   287M  2.1M  267M   1% /vo_lv
/dev/mapper/vo_vg-xfs_lv   97M  5.2M   92M   6% /xfs_lv
[root@station mapper]# 
 

2、扩展XFS_LV

[root@station mapper]# lsblk -f
NAME               FSTYPE      LABEL UUID                                   MOUNTPOINT
vda                                                                         
└─vda1             xfs               9bf6b9f7-92ad-441b-848e-0257cbb883d1   /
vdb                                                                         
├─vdb1             LVM2_member       CPb1VX-KaAB-MNLI-TcIB-XVt9-4UE5-LlaG2T 
│ └─rhce-iscsi_vol                                                          
└─vdb2             LVM2_member       MlOa9D-XH4d-n4Xn-Sief-t16B-0ktI-mqj11P 
  ├─vo_vg-vo_lv    ext4              eb51e7c8-5129-483d-b66e-de1da5692cf6   /vo_lv
  └─vo_vg-xfs_lv   xfs               b6365ecb-0100-428c-adf2-817bc9552778   /xfs_lv
[root@station mapper]# 
 

[root@station mapper]# lvextend -L 150M -n /dev/vo_vg/xfs_lv
  Rounding size to boundary between physical extents: 152.00 MiB
  Extending logical volume xfs_lv to 152.00 MiB
  Logical volume xfs_lv successfully resized
[root@station mapper]# 

umount /xfs_lv后,xfs_growfs无法执行

[root@station mapper]# xfs_growfs /dev/vo_vg/xfs_lv
xfs_growfs: /dev/vo_vg/xfs_lv is not a mounted XFS filesystem
[root@station mapper]# lvscan
  ACTIVE            '/dev/vo_vg/vo_lv' [300.00 MiB] inherit
  ACTIVE            '/dev/vo_vg/xfs_lv' [152.00 MiB] inherit
  ACTIVE            '/dev/rhce/iscsi_vol' [3.00 GiB] inherit
[root@station mapper]# mount /dev/vo_vg/xfs_lv /xfs_lv
[root@station mapper]# df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/vda1                  10G  3.3G  6.8G  33% /
devtmpfs                  906M     0  906M   0% /dev
tmpfs                     921M   84K  921M   1% /dev/shm
tmpfs                     921M   17M  904M   2% /run
tmpfs                     921M     0  921M   0% /sys/fs/cgroup
/dev/mapper/vo_vg-xfs_lv   97M  5.2M   92M   6% /xfs_lv
 

 

[root@station mapper]# xfs_growfs /dev/vo_vg/xfs_lv
meta-data=/dev/mapper/vo_vg-xfs_lv isize=256    agcount=4, agsize=6400 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0
data     =                       bsize=4096   blocks=25600, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal               bsize=4096   blocks=853, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 25600 to 38912
[root@station mapper]# df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/vda1                  10G  3.3G  6.8G  33% /
devtmpfs                  906M     0  906M   0% /dev
tmpfs                     921M   84K  921M   1% /dev/shm
tmpfs                     921M   17M  904M   2% /run
tmpfs                     921M     0  921M   0% /sys/fs/cgroup
/dev/mapper/vo_vg-xfs_lv  149M  5.3M  144M   4% /xfs_lv
[root@station mapper]# 
 


 


版权声明:本文为edging666原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。