天天看点

HANA数据库服务器备份卷扩容(Linux LVM)

HANA数据库备份出现错误,从错误上看明细是备份盘的孔家满了。

[447] backup could not be completed, [2000008] Error during asynchronous file transfer (io_getevents), rc=28: No space left on device; $fileCallback$=[W] , buffer= 

1.在AWS控制台中扩展卷,从1000G变成2000G

2.登录到机器中fdisk-l,看到磁盘大小实际上不变

3.以为需要umount,结果umount是提示失败

HANADBPRD:/hana/hanabackup/data # umount /hana/hanabackup

umount: /hana/hanabackup: target is busy

        (In some cases useful info about processes that

         use the device is found by lsof(8) or fuser(1).)

HANADBPRD:/hana/hanabackup/data # fuser -mv /hana/hanabackup

                     USER        PID ACCESS COMMAND

/hana/hanabackup:    root     kernel mount /hana/hanabackup

                     root       4031 ..c.. bash          

                     root      14117 ..c.. fuser             --c表示进程是在该目录下启动

                     root      48758 ..c.. bash

                     s4padm    45588 F.... hdbindexserver    --F表示打开文件

HANADBPRD:/hana/hanabackup/data # lsof /hana/hanabackup

COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF       NODE NAME

bash     4031 root  cwd    DIR  254,3       69  193017069 /hana/hanabackup/data

lsof    14201 root  cwd    DIR  254,3       69  193017069 /hana/hanabackup/data

lsof    14202 root  cwd    DIR  254,3       69  193017069 /hana/hanabackup/data

bash    48758 root  cwd    DIR  254,3     4096 1074766613 /hana/hanabackup/data/DB_S4P

4.修改归档日志备份配置

因为是HANA的备份设置备份到此文件夹,避免强行卸载后系统备份出现问题导致系统夯住,所以就先修改备份配置

在hana studio中以system登录,backup and recover---configuration,将log backup settings中将日志归档disable.

5.强制卸载卷 umount -l /home

6.扩容还是失败

HANADBPRD:/hana/hanabackup # growpart /dev/xvvvv4n1 1

WARN: unknown label 

failed [sfd_dump:1] sfdisk --unit=S --dump /dev/xvvvv4n1

sfdisk: /dev/xvvvv4n1: does not contain a recognized partition table

FAILED: failed to dump sfdisk info for /dev/xvvvv4n1

HANADBPRD:/ # mount /dev/xvvvv4n1 /hana/hanabackup

mount: unknown filesystem type 'LVM2_member'

原来是用LVM进行管理的,其实都可以不用umount的

7.LVM扩容

---查看卷组

HANADBPRD:/ # vgs  

  VG            #PV #LV #SN Attr   VSize    VFree

  vg_hana         3   3   0 wz--n- 1001.99g 1.99g

  vg_hanabackup   1   1   0 wz--n- 1000.00g    0 

---查看物理卷

HANADBPRD:/ # pvs

  PV           VG            Fmt  Attr PSize    PFree

  /dev/xvme2n1 vg_hana       lvm2 a--   334.00g    0 

  /dev/xvvvv4n1 vg_hanabackup lvm2 a--  1000.00g    0 

  /dev/xvme4n1 vg_hana       lvm2 a--   334.00g 1.99g

  /dev/xvme6n1 vg_hana       lvm2 a--   334.00g    0 

--扩容物理卷

HANADBPRD:/ # pvresize -v /dev/nvvvv4n1

    Using physical volume(s) on command line.

    Archiving volume group "vg_hanabackup" metadata (seqno 3).

    Resizing volume "/dev/nvvvv4n1" to 4194304000 sectors.

    Resizing physical volume /dev/nvvvv4n1 from 0 to 511999 extents.

    Updating physical volume "/dev/nvvvv4n1"

    Creating volume group backup "/etc/lvm/backup/vg_hanabackup" (seqno 4).

  Physical volume "/dev/nvvvv4n1" changed

  1 physical volume(s) resized / 0 physical volume(s) not resized

--查看物理卷,此时磁盘已经成了2T

HANADBPRD:/ # pvs

  PV           VG            Fmt  Attr PSize   PFree   

  /dev/nvvvv4n1 vg_hanabackup lvm2 a--    1.95t 1000.00g

---查看卷组

HANADBPRD:/ # vgs

  VG            #PV #LV #SN Attr   VSize    VFree   

  vg_hanabackup   1   1   0 wz--n-    1.95t 1000.00g

---查看逻辑卷,逻辑卷还是没有变化

HANADBPRD:/ # lvs

  LV            VG            Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert                                               

  lv_hanabackup vg_hanabackup -wi-ao---- 1000.00g  

--扩展逻辑卷,                                                

HANADBPRD:/ # lvextend -L +1000g /dev/vg_hanabackup/lv_hanabackup

  Size of logical volume vg_hanabackup/lv_hanabackup changed from 1000.00 GiB (255999 extents) to 1.95 TiB (511999 extents).

  Logical volume lv_hanabackup successfully resized

---查看逻辑卷,逻辑卷已变大

HANADBPRD:/ # lvs

  LV            VG            Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert

  lv_hanadata   vg_hana       -wi-ao---- 400.00g                                                    

  lv_hanalog    vg_hana       -wi-ao---- 300.00g                                                    

  lv_hanashared vg_hana       -wi-ao---- 300.00g                                                    

  lv_hanabackup vg_hanabackup -wi-ao----   1.95t  

--挂载卷并扩容,df- h中,逻辑卷还是没有扩容,

此时必须扩容卷,这个地方很容易卡住,主要原因是需要看你的文件系统用不同的工具命令:

resize2fs针对ext2/ext3/ext4 file system resize

xfs的需要使用xfs_growfs

HANADBPRD:/ # mount /dev/mapper/vg_hanabackup-lv_hanabackup /hana/hanabackup

HANADBPRD:/ # xfs_growfs /hana/hanabackup

meta-data=/dev/mapper/vg_hanabackup-lv_hanabackup isize=512    agcount=4, agsize=65535744 blks

         =                       sectsz=512   attr=2, projid32bit=1

         =                       crc=1        finobt=0 spinodes=0

data     =                       bsize=4096   blocks=262142976, imaxpct=25

         =                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0 ftype=1

log      =internal               bsize=4096   blocks=127999, version=2

         =                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

data blocks changed from 262142976 to 524286976

-查看卷大小,这个时候已经是2T了。

--df -h 

/dev/mapper/vg_hanabackup-lv_hanabackup  2.0T  733G  1.3T  37% /hana/hanabackup

8.进入hana statuio中重新启动自动归档的功能。