Como você repara o superbloco de um volume LVM? Alternativamente, como você recupera os dados em um volume lógico lmv desmontável?
Recentemente, adicionei um segundo disco rígido, estendi meu grupo de volumes e espelhei meu LV vg00/FAST
existente com lvconvert -m1 /dev/vg00/FAST
no espaço físico do novo disco. Eu também criei um segundo LV vg00/SLOW
no espaço restante do novo disco rígido. Ambos são sistemas de arquivos ext4. Meu entendimento é a implementação atual do LVM usa mdadm raid 1 por padrão para espelhamento. Estou executando lvm2 2.02.168-1
no Arch. Eu também tenho vários backups do volume LVM em /etc/lvm/archive
e /etc/lvm/backup
.
Em termos físicos, /dev/sda4
é uma partição GPT 1.79T e contém vg00/FAST
, /dev/sdc1
é uma partição LVM de 2.73T GPT e contém vg00/FAST
e vg00/SLOW
.
Durante a inicialização do Linux, recebo o seguinte erro de superbloco:
15.111767 device-mapper: raid: Failed to read superblock of device at position 1
Failed to start lvm2 PV scan on device 8:4
See systemctl status 'lvm20pvscan@8:4.service'
vg00/FAST
mounts (do /dev/sda4
mirror) e o filesystem / data estão intactos, mas o vg00/SLOW
não é montado. Parece que o LVM não lerá nenhum LV de /dev/sdb1
.
Com uma partição ext4 normal, gostaria de fsck
e seguir em frente, mas vg/SLOW
não está em /dev
, por isso não posso fsck /dev/vg00/SLOW
. Se eu fsck /dev/sdb1
o fsck entender a estrutura LVM subjacente, ou ela virá o sdb1 como uma partição ext4 corrompida e gerará um fluxo de erros?
Logs:
$ journalctl -xb
.....
Dec 08 23:21:52 hostname lvm[304]: WARNING: Device for PV g1WAG2-Dc9i-Gods-w3n7-SZD7-5Kvc-qzepno not found or rejected
Dec 08 23:21:52 hostname lvm[304]: Refusing refresh of partial LV vg00/FAST_rimage_1. Use '--activationmode partial' t
Dec 08 23:21:52 hostname lvm[304]: Refusing refresh of partial LV vg00/SLOW. Use '--activationmode partial' to overrid
Dec 08 23:21:52 hostname lvm[304]: Refusing refresh of partial LV vg00/FAST_rimage_1. Use '--activationmode partial' t
Dec 08 23:21:52 hostname lvm[304]: Refusing refresh of partial LV vg00/SLOW. Use '--activationmode partial' to overrid
Dec 08 23:21:52 hostname lvm[304]: Refusing refresh of partial LV vg00/FAST_rimage_1. Use '--activationmode partial' t
Dec 08 23:21:52 hostname lvm[304]: Refusing refresh of partial LV vg00/SLOW. Use '--activationmode partial' to overrid
Dec 08 23:21:52 hostname lvm[304]: Refusing refresh of partial LV vg00/FAST_rimage_1. Use '--activationmode partial' t
Dec 08 23:21:52 hostname lvm[304]: Refusing refresh of partial LV vg00/SLOW. Use '--activationmode partial' to overrid
Dec 08 23:21:52 hostname lvm[304]: Refusing refresh of partial LV vg00/FAST_rimage_1. Use '--activationmode partial' t
Dec 08 23:21:52 hostname lvm[304]: Refusing refresh of partial LV vg00/SLOW. Use '--activationmode partial' to overrid
.....
Dec 08 23:21:57 hostname kernel: device-mapper: raid: Failed to read superblock of device at position 1
Dec 08 23:21:58 hostname kernel: md: raid1 personality registered for level 1
Dec 08 23:21:58 hostname kernel: md/raid1:mdX: active with 1 out of 2 mirrors
Dec 08 23:21:58 hostname kernel: created bitmap (917 pages) for device mdX
Dec 08 23:21:58 hostname kernel: mdX: bitmap initialized from disk: read 58 pages, set 921 of 1876944 bits
Dec 08 23:21:58 hostname kernel: EXT4-fs (dm-6): mounted filesystem with ordered data mode. Opts: data=ordered
Dec 08 23:21:52 hostname systemd[1]: Starting Flush Journal to Persistent Storage...
-- Subject: Unit systemd-journal-flush.service has begun start-up
-- Defined-By: systemd
--
-- Unit systemd-journal-flush.service has begun starting up.
Dec 08 23:21:55 hostname dmeventd[403]: dmeventd ready for processing.
Dec 08 23:21:58 hostname lvm[304]: vg00: refresh before autoactivation failed.
Dec 08 23:21:58 hostname lvm[304]: Refusing activation of partial LV vg00/SLOW. Use '--activationmode partial' to ove
Dec 08 23:21:58 hostname lvm[304]: 1 logical volume(s) in volume group "vg00" now active
Dec 08 23:21:58 hostname lvm[304]: vg00: autoactivation failed.
Dec 08 23:21:55 hostname systemd[1]: Started Device-mapper event daemon.
-- Subject: Unit dm-event.service has finished start-up
-- Defined-By: systemd
--
-- Unit dm-event.service has finished starting up.
--
-- The start-up result is done.
Dec 08 23:21:55 hostname lvm[403]: Monitoring RAID device vg00-FAST for events.
Dec 08 23:21:55 hostname systemd[1]: Found device /dev/vg00/FAST.
-- Subject: Unit dev-vg00-FAST.device has finished start-up
-- Defined-By: systemd
--
-- Unit dev-vg00-FAST.device has finished starting up.
--
-- The start-up result is done.
Dec 08 23:21:55 hostname systemd[1]: lvm2-pvscan@8:4.service: Main process exited, code=exited, status=5/NOTINSTALLED
Dec 08 23:21:55 hostname systemd[1]: Failed to start LVM2 PV scan on device 8:4.
-- Subject: Unit lvm2-pvscan@8:4.service has failed
-- Defined-By: systemd
--
-- Unit lvm2-pvscan@8:4.service has failed.
--
-- The result is failed.
Dec 08 23:21:55 hostname systemd[1]: lvm2-pvscan@8:4.service: Unit entered failed state.
Dec 08 23:21:58 hostname systemd-fsck[409]: /dev/mapper/vg00-FAST: clean, 5273/120127488 files, 389615339/480497664 bloc
Dec 08 23:21:55 hostname systemd[1]: lvm2-pvscan@8:4.service: Failed with result 'exit-code'.
Dec 08 23:21:55 hostname systemd[1]: Starting File System Check on /dev/vg00/FAST...
-- Subject: Unit [email protected] has begun start-up
-- Defined-By: systemd
--
-- Unit [email protected] has begun starting up.
Dec 08 23:21:56 hostname systemd[1]: Started File System Check on /dev/vg00/FAST.
-- Subject: Unit [email protected] has finished start-up
-- Defined-By: systemd
--
-- Unit [email protected] has finished starting up.
lvdisplay:
$ lvdisplay -v
WARNING: Device for PV g1WAG2-Dc9i-Gods-w3n7-SZD7-5Kvc-qzepno not found or rejected by a filter.
There are 1 physical volumes missing.
There are 1 physical volumes missing.
--- Logical volume ---
LV Path /dev/vg00/FAST
LV Name FAST
VG Name vg00
LV UUID g7lYit-lsR3-WvoE-Idfj-C8kE-kcz4-VXpS1D
LV Write Access read/write
LV Creation host, time host, 2015-12-02 21:06:11 -0500
LV Status available
# open 1
LV Size 1.79 TiB
Current LE 469236
Mirrored volumes 2
Segments 1
Allocation contiguous
Read ahead sectors auto
- currently set to 256
Block device 254:6
--- Logical volume ---
LV Path /dev/vg00/SLOW
LV Name SLOW
VG Name vg00
LV UUID u2ExhF-DFCH-U1Yc-M1WM-aIUl-bODu-FILusX
LV Write Access read/write
LV Creation host, time host, 2016-12-07 09:16:22 -0500
LV Status NOT available
LV Size 961.56 GiB
Current LE 246159
Segments 1
Allocation contiguous
Read ahead sectors auto
lvscan:
$ lvscan -v
WARNING: Device for PV g1WAG2-Dc9i-Gods-w3n7-SZD7-5Kvc-qzepno not found or rejected by a filter.
There are 1 physical volumes missing.
There are 1 physical volumes missing.
ACTIVE '/dev/vg00/FAST' [1.79 TiB] contiguous
inactive '/dev/vg00/SLOW' [961.56 GiB] contiguous
lvmdiskscan:
$ lvmdiskscan
/dev/sda2 [ 20.00 GiB]
/dev/sda3 [ 8.00 GiB]
/dev/sda4 [ 1.79 TiB] LVM physical volume
/dev/vg00/FAST [ 1.79 TiB]
/dev/sdb1 [ 2.73 TiB]
2 disks
5 partitions
0 LVM physical volume whole disks
1 LVM physical volume
A estrutura da partição do gdisk parece OK:
$ gdisk -l /dev/sdb
GPT fdisk (gdisk) version 1.0.1
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sdb: 5860533168 sectors, 2.7 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 9B452B16-4F7C-4F3E-B54F-0B46C7B978E1
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860533134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 5860533134 2.7 TiB 8E00 Linux LVM
Testdisk, parece OK também:
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <[email protected]>
http://www.cgsecurity.org
Disk /dev/sdb - 3000 GB / 2794 GiB - CHS 364801 255 63
Current partition structure:
Partition Start End Size in sectors
No LVM or LVM2 structure
1 P Linux LVM 2048 5860533134 5860531087 [Linux LVM]
1 P Linux LVM 2048 5860533134 5860531087 [Linux LVM]
tentar montar a partição produz diretamente:
$ mount /dev/sdb1 /mnt/TMP/
mount: mount /dev/sdb1 on /mnt/TMP failed: Structure needs cleaning
Editado para adicionar:
Parece que o problema do ponto de vista do LVM é que existe "Não foi possível encontrar o rótulo do LVM em / dev / sdb1". Posso recriar um rótulo LVM, seja lá o que isso for em /dev/sdb1
?
pvscan:
$ pvscan -v
Wiping internal VG cache
Wiping cache of LVM-capable devices
WARNING: Device for PV g1WAG2-Dc9i-Gods-w3n7-SZD7-5Kvc-qzepno not found or rejected by a filter.
There are 1 physical volumes missing.
There are 1 physical volumes missing.
PV /dev/sda4 VG vg00 lvm2 [1.79 TiB / 4.00 MiB free]
PV [unknown] VG vg00 lvm2 [2.73 TiB / 0 free]
Total: 2 [4.52 TiB] / in use: 2 [4.52 TiB] / in no VG: 0 [0 ]
pvck na nova partição não funcional:
$ pvck -v /dev/sdb1
Scanning /dev/sdb1
Could not find LVM label on /dev/sdb1
pvck na partição lvm original (em funcionamento):
$ pvck -v /dev/sda4
Scanning /dev/sda4
Found label on /dev/sda4, sector 1, type=LVM2 001
Found text metadata area: offset=4096, size=1044480
Found LVM2 metadata record at offset=52224, size=3072, offset2=0 size2=0
Found LVM2 metadata record at offset=49152, size=3072, offset2=0 size2=0
Found LVM2 metadata record at offset=46080, size=3072, offset2=0 size2=0
Found LVM2 metadata record at offset=43520, size=2560, offset2=0 size2=0
Found LVM2 metadata record at offset=40960, size=2560, offset2=0 size2=0
Found LVM2 metadata record at offset=38400, size=2560, offset2=0 size2=0
Found LVM2 metadata record at offset=35840, size=2560, offset2=0 size2=0
Found LVM2 metadata record at offset=33280, size=2560, offset2=0 size2=0
Found LVM2 metadata record at offset=30720, size=2560, offset2=0 size2=0
Found LVM2 metadata record at offset=28160, size=2560, offset2=0 size2=0
Found LVM2 metadata record at offset=25600, size=2560, offset2=0 size2=0
Found LVM2 metadata record at offset=23040, size=2560, offset2=0 size2=0
Found LVM2 metadata record at offset=21504, size=1536, offset2=0 size2=0
Found LVM2 metadata record at offset=19968, size=1536, offset2=0 size2=0
Found LVM2 metadata record at offset=18432, size=1536, offset2=0 size2=0
Found LVM2 metadata record at offset=16896, size=1536, offset2=0 size2=0
Found LVM2 metadata record at offset=15360, size=1536, offset2=0 size2=0
Found LVM2 metadata record at offset=13824, size=1536, offset2=0 size2=0
Found LVM2 metadata record at offset=12288, size=1536, offset2=0 size2=0
Found LVM2 metadata record at offset=10752, size=1536, offset2=0 size2=0
Found LVM2 metadata record at offset=9216, size=1536, offset2=0 size2=0
Found LVM2 metadata record at offset=7680, size=1536, offset2=0 size2=0
Found LVM2 metadata record at offset=6144, size=1536, offset2=0 size2=0
lsblk:
$ lsblk -o name,mountpoint,label,size,uuid
NAME MOUNTPOINT LABEL SIZE UUID
sdb 2.7T
└─sdb1 BACKUP 2.7T a1b354f4-dea8-4b39-9520-aebcf6c9c72f
vg00-FAST_rimage_1-missing_0_0 1.8T
└─vg00-FAST_rimage_1 1.8T
sr0 Parted Magic 2016_01_06 494M 2016-01-13-12-09-50-00
vg00-FAST_rmeta_1-missing_0_0 4M
└─vg00-FAST_rmeta_1 4M
loop0 30G d5ce3be0-00fc-4f73-8ee4-989440310d23
└─docker-8:2-410226-pool 30G
sda 1.8T
├─sda4 1.8T UDq1dm-JH3Z-aCIX-3oQy-1ZDG-kNoi-BdNtkK
│ ├─vg00-FAST_rimage_0 1.8T
│ │ └─vg00-FAST /mnt/FAST 1.8T b78849e7-3399-444f-b98f-cba61d073961
│ └─vg00-FAST_rmeta_0 4M
│ └─vg00-FAST /mnt/FAST 1.8T b78849e7-3399-444f-b98f-cba61d073961
├─sda2 / rootfs 20G ae45e705-67f4-4269-88e3-06d8e77a9e36
├─sda3 [SWAP] 8G 22a40da7-d0f9-4371-a585-8d49dc585708
└─sda1 1007K