Btrfs partition 복구
Ubuntu 서버 12.04.2 LTS를 btrfs 루트파티션에 설치해 사용중이다.
파일시스템 체크를 했더니 아래와 같은 오류가 생겼고
재부팅해보니 부팅이 안 되었다.

$ sudo btrfsck /dev/sdh1
parent transid verify failed on 5405835264 wanted 1329246 found 1329238
parent transid verify failed on 5405835264 wanted 1329246 found 1329238
parent transid verify failed on 5405872128 wanted 1329246 found 1329238
bad block 5403226112
Extent back ref already exists for 3521540096 parent 0 root 256
Extent back ref already exists for 3526455296 parent 0 root 256
Extent back ref already exists for 3532865536 parent 0 root 256
Extent back ref already exists for 3524308992 parent 0 root 256
Extent back ref already exists for 3529961472 parent 0 root 256
Extent back ref already exists for 3529433088 parent 0 root 256
Extent back ref already exists for 3521957888 parent 0 root 256
Extent back ref already exists for 3520847872 parent 0 root 256
Extent back ref already exists for 3527602176 parent 0 root 256
Extent back ref already exists for 3527675904 parent 0 root 256
Extent back ref already exists for 3528564736 parent 0 root 256
Extent back ref already exists for 3523358720 parent 0 root 256
Extent back ref already exists for 3523379200 parent 0 root 256
Extent back ref already exists for 3525251072 parent 0 root 256
Extent back ref already exists for 3519803392 parent 0 root 256
Extent back ref already exists for 3530899456 parent 0 root 256
Extent back ref already exists for 3525160960 parent 0 root 256
Extent back ref already exists for 3519590400 parent 0 root 256
Extent back ref already exists for 3528359936 parent 0 root 256
Extent back ref already exists for 5403230208 parent 0 root 256
parent transid verify failed on 5405827072 wanted 1329246 found 1329238
parent transid verify failed on 5405827072 wanted 1329246 found 1329238
leaf 4329545728 items 28 free space 1867 generation 1228765 owner 2
fs uuid e397f1b7-0bcb-446a-8440-3739915f9531
chunk uuid 10526551-2975-4c86-af32-b0b333a900c1
        item 0 key (3519406080 EXTENT_ITEM 4096) itemoff 3944 itemsize 51
                extent refs 1 gen 995624 flags 2
                tree block key (18446744073709551606 80 169921544192) level 0
                tree block backref root 7
        item 1 key (3519422464 EXTENT_ITEM 4096) itemoff 3893 itemsize 51
                extent refs 1 gen 995650 flags 2
                tree block key (18446744073709551606 80 172983779328) level 0
                tree block backref root 7
        item 2 key (3519426560 EXTENT_ITEM 4096) itemoff 3842 itemsize 51
                extent refs 1 gen 996646 flags 2
                tree block key (4504182 c 1289264) level 0
                tree block backref root 256
        item 3 key (3519430656 EXTENT_ITEM 4096) itemoff 3791 itemsize 51
                extent refs 1 gen 995678 flags 2
                tree block key (4489070 1 0) level 0
                tree block backref root 256
        item 4 key (3519438848 EXTENT_ITEM 4096) itemoff 3740 itemsize 51
                extent refs 1 gen 995785 flags 2
                tree block key (4492731 1 0) level 0
                tree block backref root 256
        item 5 key (3519442944 EXTENT_ITEM 4096) itemoff 3689 itemsize 51
                extent refs 1 gen 995517 flags 2
                tree block key (4486383 6c 24576) level 0
                tree block backref root 256
        item 6 key (3519447040 EXTENT_ITEM 4096) itemoff 3638 itemsize 51
                extent refs 1 gen 995612 flags 2
                tree block key (18446744073709551606 80 171795283968) level 0
                tree block backref root 7
        item 7 key (3519459328 EXTENT_ITEM 4096) itemoff 3587 itemsize 51
                extent refs 1 gen 997346 flags 2
                tree block key (4529968 1 0) level 0
                tree block backref root 256
        item 8 key (3519467520 EXTENT_ITEM 4096) itemoff 3536 itemsize 51
                extent refs 1 gen 1024782 flags 2
                tree block key (4001070 1 0) level 0
                tree block backref root 256
        item 9 key (3519471616 EXTENT_ITEM 4096) itemoff 3485 itemsize 51
                extent refs 1 gen 995612 flags 2
                tree block key (18446744073709551606 80 171792793600) level 0
                tree block backref root 7
        item 10 key (3519475712 EXTENT_ITEM 4096) itemoff 3434 itemsize 51
                extent refs 1 gen 995612 flags 2
                tree block key (18446744073709551606 80 171798560768) level 0
                tree block backref root 7
        item 11 key (3519483904 EXTENT_ITEM 4096) itemoff 3383 itemsize 51
                extent refs 1 gen 995612 flags 2
                tree block key (18446744073709551606 80 171802558464) level 0
                tree block backref root 7
        item 12 key (3519488000 EXTENT_ITEM 4096) itemoff 3332 itemsize 51
                extent refs 1 gen 995754 flags 2
                tree block key (4491715 c 1289264) level 0
                tree block backref root 256
        item 13 key (3519496192 EXTENT_ITEM 4096) itemoff 3281 itemsize 51
                extent refs 1 gen 995866 flags 2
                tree block key (4495535 1 0) level 0
                tree block backref root 256
        item 14 key (3519500288 EXTENT_ITEM 4096) itemoff 3230 itemsize 51
                extent refs 1 gen 996641 flags 2
                tree block key (18446744073709551606 80 164841373696) level 0
                tree block backref root 7
        item 15 key (3519504384 EXTENT_ITEM 4096) itemoff 3179 itemsize 51
                extent refs 1 gen 995612 flags 2
                tree block key (18446744073709551606 80 171805376512) level 0
                tree block backref root 7
        item 16 key (3519508480 EXTENT_ITEM 4096) itemoff 3128 itemsize 51
                extent refs 1 gen 995509 flags 2
                tree block key (18446744073709551606 80 170855956480) level 0
                tree block backref root 7
        item 17 key (3519516672 EXTENT_ITEM 4096) itemoff 3077 itemsize 51
                extent refs 1 gen 995612 flags 2
                tree block key (18446744073709551606 80 171807342592) level 0
                tree block backref root 7
        item 18 key (3519520768 EXTENT_ITEM 4096) itemoff 3026 itemsize 51
                extent refs 1 gen 995612 flags 2
                tree block key (4487103 c 1289264) level 0
                tree block backref root 256
        item 19 key (3519524864 EXTENT_ITEM 4096) itemoff 2975 itemsize 51
                extent refs 1 gen 962003 flags 2
                tree block key (3611527 1 0) level 0
                tree block backref root 256
        item 20 key (3519528960 EXTENT_ITEM 4096) itemoff 2924 itemsize 51
                extent refs 1 gen 1023778 flags 2
                tree block key (4621789 c 35011) level 1
                tree block backref root 256
        item 21 key (3519533056 EXTENT_ITEM 4096) itemoff 2873 itemsize 51
                extent refs 1 gen 995612 flags 2
                tree block key (18446744073709551606 80 171811377152) level 0
                tree block backref root 7
        item 22 key (3519537152 EXTENT_ITEM 4096) itemoff 2822 itemsize 51
                extent refs 1 gen 995612 flags 2
                tree block key (18446744073709551606 80 171813765120) level 0
                tree block backref root 7
        item 23 key (3519549440 EXTENT_ITEM 4096) itemoff 2771 itemsize 51
                extent refs 1 gen 1023558 flags 2
                tree block key (4621894 6c 0) level 0
                tree block backref root 256
        item 24 key (3519553536 EXTENT_ITEM 4096) itemoff 2720 itemsize 51
                extent refs 1 gen 996710 flags 2
                tree block key (4506509 c 1289264) level 0
                tree block backref root 256
        item 25 key (3519561728 EXTENT_ITEM 4096) itemoff 2669 itemsize 51
                extent refs 1 gen 997445 flags 2
                tree block key (4532999 c 1289264) level 0
                tree block backref root 256
        item 26 key (3519565824 EXTENT_ITEM 4096) itemoff 2618 itemsize 51
                extent refs 1 gen 995612 flags 2
                tree block key (18446744073709551606 80 171816976384) level 0
                tree block backref root 7
        item 27 key (3519569920 EXTENT_ITEM 4096) itemoff 2567 itemsize 51
                extent refs 1 gen 997487 flags 2
                tree block key (1327512 6c 16293888) level 0
                tree block backref root 256
failed to find block number 3519512576
$ sudo btrfsck /dev/sdg1
btrfsck: btrfsck.c:1928: check_owner_ref: Assertion `!(rec->is_root)' failed.
$ sudo btrfs filesystem show /dev/sdg1
Label: 'root'  uuid: e397f1b7-0bcb-446a-8440-3739915f9531
        Total devices 2 FS bytes used 104.68GB
        devid    1 size 915.51GB used 162.03GB path /dev/sdg1
        devid    2 size 915.51GB used 162.01GB path /dev/sdh1

Btrfs Btrfs v0.19
$ sudo init 6
$


sysresccd로 부팅해서도 위 로그 끝부분과 마찬가지로 Assertion fail 오류가 생겼다.
확인해보니 btrfs를 구성하고 있던 /dev/sdg1, /dev/sdh1 파티션을 담고있던
두 개의 디스크 가운데 /dev/sdh의 파티션테이블이 사라져 있었다.
아래 명령으로 sdg의 파티션 레이아웃을 복제해서 sdh의 파티션 테이블을 복구해주니 볼륨이 다시 살아났다.

$ sfdisk -d /dev/sdg | sfdisk /dev/sdh

참고: How to copy the partition layout of a whole disk using standard tools


이 볼륨을 이용해 부팅 성공한 다음, 아래 명령도 실행했다.

$ sudo btrfs filesystem balance /

by 시험さま | 2015/06/15 10:59 | 컴퓨터 | 트랙백 | 덧글(0)
트랙백 주소 : http://chanik.egloos.com/tb/4087131
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]

:         :

:

비공개 덧글

< 이전페이지 다음페이지 >