출처 - kldp
아무튼간에 superblock 을 완전히 날리면되므로, 넉넉하게 2048 바이트.
http://kldp.org/node/91716
xxd 로 보면
[bushi@rose webfb]$ sudo e2label /dev/sda1
/boot
[bushi@rose webfb]$
[bushi@rose webfb]$ sudo xxd -g 1 -s +1024 -l 128 /dev/sda1
0000400: f8 65 00 00 c4 97 01 00 63 14 00 00 ce 22 01 00 .e……c…."..
0000410: cc 65 00 00 01 00 00 00 00 00 00 00 00 00 00 00 .e…………..
0000420: 00 20 00 00 00 20 00 00 d8 07 00 00 76 2a a2 49 . … ……v*.I
0000430: 76 2a a2 49 0b 00 ff ff 53 ef 01 00 01 00 00 00 v*.I….S…….
0000440: d0 29 4a 49 00 00 00 00 00 00 00 00 01 00 00 00 .)JI…………
0000450: 00 00 00 00 0b 00 00 00 80 00 00 00 3c 00 00 00 …………<…
0000460: 06 00 00 00 01 00 00 00 68 33 36 f2 0d ae 4a 3c ……..h36…J<
0000470: bf b1 57 e5 26 c5 7d 73 2f 62 6f 6f 74 00 00 00 ..W.&.}s/boot…
[bushi@rose webfb]$
[bushi@rose webfb]$ sudo e2label /dev/sda2
/
[bushi@rose webfb]$
[bushi@rose webfb]$ sudo xxd -g 1 -s +1024 -l 128 /dev/sda2
0000400: f0 0b 28 00 9c 02 a0 00 21 00 08 00 44 24 0f 00 ..(…..!…D$..
0000410: f1 95 23 00 00 00 00 00 02 00 00 00 02 00 00 00 ..#………….
0000420: 00 80 00 00 00 80 00 00 f0 1f 00 00 76 2a a2 49 …………v*.I
0000430: 76 2a a2 49 0b 00 ff ff 53 ef 01 00 01 00 00 00 v*.I….S…….
0000440: 30 29 4a 49 00 00 00 00 00 00 00 00 01 00 00 00 0)JI…………
0000450: 00 00 00 00 0b 00 00 00 00 01 00 00 3c 00 00 00 …………<…
0000460: 06 00 00 00 03 00 00 00 77 36 00 c6 61 b4 4e 48 ……..w6..a.NH
0000470: 97 58 c6 36 ee 2b b5 e4 2f 00 00 00 00 00 00 00 .X.6.+../…….
[bushi@rose webfb]$
1024 + 120 번째 바이트 부근에 volume lable 이 있는 것 같습니다.
+
좀 다르게
[bushi@rose webfb]$ blkid /dev/sda1
/dev/sda1: LABEL="/boot" UUID="683336f2-0dae-4a3c-bfb1-57e526c57d73" TYPE="ext3" SEC_TYPE="ext2"
[bushi@rose webfb]$
[bushi@rose webfb]$ blkid /dev/sda2
/dev/sda2: LABEL="/" UUID="773600c6-61b4-4e48-9758-c636ee2bb5e4" TYPE="ext3" SEC_TYPE="ext2"
[bushi@rose webfb]$
[bushi@rose webfb]$ blkid /dev/sda3
/dev/sda3: TYPE="swap" LABEL="SWAP-sda3" UUID="f5f5aa7e-b74f-49d4-b0a1-61537aad6ac0"
[bushi@rose webfb]$
[bushi@rose webfb]$ sudo xxd -g 1 -s +1024 -l 128 /dev/sda3
0000400: 01 00 00 00 57 ff 07 00 00 00 00 00 f5 f5 aa 7e ….W……….~
0000410: b7 4f 49 d4 b0 a1 61 53 7a ad 6a c0 53 57 41 50 .OI…aSz.j.SWAP
0000420: 2d 73 64 61 33 00 00 00 00 00 00 00 00 00 00 00 -sda3………..
0000430: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …………….
0000440: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …………….
0000450: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …………….
0000460: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …………….
0000470: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …………….
[bushi@rose webfb]$
type, filesystem 별로 superblock 위치와 정보가 다르니.. 쫌 난감하군요.
넉넉하게 4096바이트 ?
dd if=/dev/zero of=/dev/sda count=1 bs=4096
아래는 Superblock 내용 dump 하는법
구조를 아신다면 hexdump 로 바로 보실 수 있습니다.
[bushi@rose python_binding]$
[bushi@rose python_binding]$ sudo hexdump -e '"%08.8_ax " 16/1 "%02x " "\n"' -s 1024 -n 128 /dev/sda1
00000400 00 80 ca 05 37 70 ca 05 35 1f 4a 00 21 76 40 04
00000410 21 10 9d 05 00 00 00 00 02 00 00 00 02 00 00 00
00000420 00 80 00 00 00 80 00 00 00 80 00 00 23 48 cb 47
00000430 23 48 cb 47 1b 00 ff ff 53 ef 01 00 01 00 00 00
00000440 26 7c 13 47 00 00 00 00 00 00 00 00 01 00 00 00
00000450 00 00 00 00 0b 00 00 00 80 00 00 00 3c 00 00 00
00000460 06 00 00 00 03 00 00 00 8a 75 0f 7c 2a 4a 40 4d
00000470 a9 92 e0 f4 4f a9 a5 c1 2f 00 00 00 00 00 00 00
[bushi@rose python_binding]$
중간에 53 ef 보이시죠 ? 저 magic code 전후로 어느 정도만큼이 superblock 입니다.
특별히 선호하는 에디터나 뷰어가 있다면
dd if=/dev/sda1 of=dump.bin bs=128 count=1 skip=8
처럼 파일로 저장해서 보시면 되겠습니다.
xdd를 이용해 하드디스크 라벨정보(superblock정보)보기/지우기