linux GPT格式分区丢失处理

时间:2024-03-01 18:46:48

因客户检修断电,来电后发现数据库恢复正常,但备份磁盘的分区丢失,如下图

[root@db1 ~]#  df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/LVMgroup-root
                       99G  9.7G   84G  11% /
tmpfs                 252G  805M  252G   1% /dev/shm
/dev/sda1             477M   81M  367M  19% /boot
/dev/mapper/LVMgroup-u01     558G   15G  515G   3% /u01

[root@db1 ~]# blkid |grep asm-backupp1

[root@db1 ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Thu Sep  6 04:07:09 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/LVMgroup-root /                       ext4    defaults        0 0
UUID=6b99d5ae-4e0b-42a5-94af-7b29a5892f2f /boot                   ext4    defaults        0 0
/dev/mapper/LVMgroup-u01 /u01                    ext4    defaults        1 2
/dev/mapper/LVMgroup-swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
asm-backupp1    /backup ext4    defaults        0 0
/dev/mapper/asm-backupp1    /backup ext4    defaults        0 0
[root@db1 ~]# mount -a
mount: special device /dev/mapper/asm-backupp1 does not exist

[root@db1 ~]#  multipath -ll
asm-backup (3683df501009697e0307131667a026101) dm-11 HUAWEI,VIS6000
size=2.0T features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
  |- 6:0:0:10 sdk  8:160  active ready running
  |- 8:0:0:10 sdae 65:224 active ready running
  |- 6:0:1:10 sdu  65:64  active ready running
  `- 8:0:1:10 sdao 66:128 active ready running
[root@db1 ~]#  fdisk -l /dev/mapper/asm-backup

WARNING: GPT (GUID Partition Table) detected on '/dev/mapper/asm-backup'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/mapper/asm-backup: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

                 Device Boot      Start         End      Blocks   Id  System
/dev/mapper/asm-backupp1               1      267350  2147483647+  ee  GPT

[root@db1 ~]#  parted  /dev/mapper/asm-backup
GNU Parted 2.1
Using /dev/mapper/asm-backup
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/asm-backup: 2199GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name    Flags
 1      17.4kB  2199GB  2199GB  ext4         backup

(parted)       

[root@db1 ~]#  lsblk
NAME                     MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                        8:0    0   1.1T  0 disk  
├─sda1                     8:1    0   500M  0 part  /boot
└─sda2                     8:2    0   1.1T  0 part  
  ├─LVMgroup-swap (dm-0) 251:0    0   200G  0 lvm   [SWAP]
  ├─LVMgroup-root (dm-1) 251:1    0   100G  0 lvm   /
  ├─LVMgroup-tmp (dm-12) 251:12   0    50G  0 lvm   /tmp
  ├─LVMgroup-var (dm-13) 251:13   0   100G  0 lvm   /var
  ├─LVMgroup-u01 (dm-14) 251:14   0 566.3G  0 lvm   /u01
  └─LVMgroup-usr (dm-15) 251:15   0   100G  0 lvm   /usr
sdk                        8:160  0     2T  0 disk  
└─asm-backup (dm-11)     251:11   0     2T  0 mpath
sdu                       65:64   0     2T  0 disk  
└─asm-backup (dm-11)     251:11   0     2T  0 mpath
sdae                      65:224  0     2T  0 disk  
└─asm-backup (dm-11)     251:11   0     2T  0 mpath
sdao                      66:128  0     2T  0 disk  
└─asm-backup (dm-11)     251:11   0     2T  0 mpath

最终办法:

[root@db1 ~]# partprobe /dev/mapper/asm-backup
You have mail in /var/spool/mail/root
[root@db1 ~]#   blkid |grep asm-backupp1
/dev/mapper/asm-backupp1: UUID="ca2353fe-6e16-4c8d-bff7-8ea3032e1bbe" TYPE="ext4"
[root@db1 ~]#   mount -a
[root@db1 ~]#  df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/LVMgroup-root
                       99G  9.7G   84G  11% /
tmpfs                 252G  805M  252G   1% /dev/shm
/dev/sda1             477M   81M  367M  19% /boot
/dev/mapper/LVMgroup-u01
                      558G   15G  515G   3% /u01
/dev/mapper/asm-backupp1       2.0T  333G  1.6T  18% /backup