case 1. pv 디스크중 한장을 잃어버렸을 경우 - 결국 데이터 유실
오류
[root@localhost ~]# lvs
WARNING: Device for PV bEXCJ9-se0Q-WTjC-l24Z-9Xxp-cC4k-8fMfVe not found or rejected by a filter.
Couldn't find device with uuid bEXCJ9-se0Q-WTjC-l24Z-9Xxp-cC4k-8fMfVe.
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- <6.20g
swap centos -wi-ao---- 820.00m
testvg test -wi-----p- 3.99g
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID frei8p-d4lf-iOrE-nOQ4-qpWa-beuE-sGCqSr
LV Write Access read/write
LV Creation host, time localhost, 2020-12-30 09:08:28 +0900
LV Status available
# open 2
LV Size 820.00 MiB
Current LE 205
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID jhqADU-4Nin-kzyD-8Y5I-YR0H-5hPE-56ht6N
LV Write Access read/write
LV Creation host, time localhost, 2020-12-30 09:08:28 +0900
LV Status available
# open 1
LV Size <6.20 GiB
Current LE 1586
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
WARNING: Device for PV bEXCJ9-se0Q-WTjC-l24Z-9Xxp-cC4k-8fMfVe not found or rejected by a filter.
Couldn't find device with uuid bEXCJ9-se0Q-WTjC-l24Z-9Xxp-cC4k-8fMfVe.
--- Logical volume ---
LV Path /dev/test/testvg
LV Name testvg
VG Name test
LV UUID cbZ65o-clWi-qeRO-Bi8f-x0o9-a5Uo-VZREjt
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2022-05-17 12:57:43 +0900
LV Status NOT available
LV Size 3.99 GiB
Current LE 1022
Segments 2
Allocation inherit
Read ahead sectors auto
mount /dev/mapper/test-testvg /test
mount: special device /dev/mapper/test-testvg does not exist
1) 신규 디스크 mount
2) 8e타입으로 설정
[root@localhost ~]# fdisk /dev/sde
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x6b5a4a32.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-4194303, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-4194303, default 4194303):
Using default value 4194303
Partition 1 of type Linux and of size 2 GiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
3) 고장난 디스크 uuid값 확인
vdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name centos
PV Size <7.00 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 1791
Free PE 0
Allocated PE 1791
PV UUID AapF2u-Ceuw-bqhx-NuPu-1Zcf-elzT-5bhKUs
WARNING: Device for PV bEXCJ9-se0Q-WTjC-l24Z-9Xxp-cC4k-8fMfVe not found or rejected by a filter.
Couldn't find device with uuid bEXCJ9-se0Q-WTjC-l24Z-9Xxp-cC4k-8fMfVe.
--- Physical volume ---
PV Name /dev/sdd1
VG Name test
PV Size <2.00 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 511
Free PE 0
Allocated PE 511
PV UUID 22uK5E-epaM-OD6j-8is5-g91P-PifE-Wt6bmw
--- Physical volume ---
PV Name [unknown]
VG Name test
PV Size <2.00 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 511
Free PE 0
Allocated PE 511
PV UUID bEXCJ9-se0Q-WTjC-l24Z-9Xxp-cC4k-8fMfVe
4) lvm 설정값 확인
경로 : /etc/lvm/archive
내경우엔 : test_00002-463071372.vg
명령어 : pvcreate --uuid bEXCJ9-se0Q-WTjC-l24Z-9Xxp-cC4k-8fMfVe --restorefile /etc/lvm/archive/test_00002-463071372.vg /dev/sde1
Couldn't find device with uuid bEXCJ9-se0Q-WTjC-l24Z-9Xxp-cC4k-8fMfVe.
WARNING: Device for PV bEXCJ9-se0Q-WTjC-l24Z-9Xxp-cC4k-8fMfVe not found or rejected by a filter.
Physical volume "/dev/sde1" successfully created.
5) lvchange
lvchange -ay /dev/test/testvg
6) 마운트 시도
mount /dev/test/testvg /test
find /test -type f
find: ‘./1’: 입력/출력 오류
find: ‘./3.5.3.1’: 입력/출력 오류
[root@localhost test]# ls
ls: cannot access 1: 입력/출력 오류
ls: cannot access 3.5.3.1: 입력/출력 오류
7) fsck 수행
fsck.ext4 -y /dev/mapper/test-testvg
e2fsck 1.42.9 (28-Dec-2013)
/dev/mapper/test-testvg contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Entry '1' in / (2) has deleted/unused inode 130817. Clear? yes
Entry '3.5.3.1' in / (2) has deleted/unused inode 130818. Clear? yes
Entry '..' in <147253>/<12> (12) has deleted/unused inode 147253. Clear? yes
Entry '..' in <147253>/<18> (18) has deleted/unused inode 147253. Clear? yes
Entry '..' in <147253>/<20> (20) has deleted/unused inode 147253. Clear? yes
......
8) 문제는 복구가 되더라도 inode를 잃어버려 lost+found 파일이 이동된다
- 즉 파티션만 살아날 뿐 데이터는 안녕
- 모든 데이터는 아니지만, 경로는 수동으로 다 찾아줘야하는건가?
'01. operation > ii. base command' 카테고리의 다른 글
iso 이미지를 통해 yum update 방법 (yum repository) (0) | 2012.09.19 |
---|---|
lvm 구성 (0) | 2012.09.12 |
리눅스 램 드라이브 (램 디스크) (0) | 2010.07.15 |
ps (0) | 2009.07.27 |
sar (0) | 2009.07.27 |