바뀜

둘러보기로 가기 검색하러 가기
4,398 바이트 추가됨 ,  2018년 6월 10일 (일) 00:17
MBR은 디스크의 파티션에 대한 정보를 가지고 있습니다.
 
리눅스 시스템에서 커맨드로 MBR 정보를 확인할 방법은 없을까요? 아래와 같이 dd if=/dev/sda bs=512 count=1 | hexdump -C 명령을 이용해서 bs(block size)를 512 바이트로 지정(bs=512)하여 MBR의 크기만큼 1번(count=1)읽어옵니다. 이 값을 hexdump -C 명령을 통해서 hex+ASCII로 출력하면 MBR에 대한 내용을 확인할 수 있습니다.<ref>https://www.linuxquestions.org/questions/linux-newbie-8/how-to-see-master-boot-record-773428/#post3779598</ref> 아래처럼 GRUB에 대한 아스키도 보입니다.
 
<syntaxhighlight lang="hexdump" highlight="26">
root@debian-buster:~# dd if=/dev/sda bs=512 count=1 | hexdump -C
00000000 eb 63 90 10 8e d0 bc 00 b0 b8 00 00 8e d8 8e c0 |.c..............|
00000010 fb be 00 7c bf 00 06 b9 00 02 f3 a4 ea 21 06 00 |...|.........!..|
00000020 00 be be 07 38 04 75 0b 83 c6 10 81 fe fe 07 75 |....8.u........u|
00000030 f3 eb 16 b4 02 b0 01 bb 00 7c b2 80 8a 74 01 8b |.........|...t..|
00000040 4c 02 cd 13 ea 00 7c 00 00 eb fe 00 00 00 00 00 |L.....|.........|
00000050 00 00 00 00 00 00 00 00 00 00 00 80 01 00 00 00 |................|
00000060 00 00 00 00 ff fa 90 90 f6 c2 80 74 05 f6 c2 70 |...........t...p|
00000070 74 02 b2 80 ea 79 7c 00 00 31 c0 8e d8 8e d0 bc |t....y|..1......|
00000080 00 20 fb a0 64 7c 3c ff 74 02 88 c2 52 bb 17 04 |. ..d|<.t...R...|
00000090 f6 07 03 74 06 be 88 7d e8 17 01 be 05 7c b4 41 |...t...}.....|.A|
000000a0 bb aa 55 cd 13 5a 52 72 3d 81 fb 55 aa 75 37 83 |..U..ZRr=..U.u7.|
000000b0 e1 01 74 32 31 c0 89 44 04 40 88 44 ff 89 44 02 |..t21..D.@.D..D.|
000000c0 c7 04 10 00 66 8b 1e 5c 7c 66 89 5c 08 66 8b 1e |....f..\|f.\.f..|
000000d0 60 7c 66 89 5c 0c c7 44 06 00 70 b4 42 cd 13 72 |`|f.\..D..p.B..r|
000000e0 05 bb 00 70 eb 76 b4 08 cd 13 73 0d 5a 84 d2 0f |...p.v....s.Z...|
000000f0 83 d0 00 be 93 7d e9 82 00 66 0f b6 c6 88 64 ff |.....}...f....d.|
00000100 40 66 89 44 04 0f b6 d1 c1 e2 02 88 e8 88 f4 40 |@f.D...........@|
00000110 89 44 08 0f b6 c2 c0 e8 02 66 89 04 66 a1 60 7c |.D.......f..f.`||
00000120 66 09 c0 75 4e 66 a1 5c 7c 66 31 d2 66 f7 34 88 |f..uNf.\|f1.f.4.|
00000130 d1 31 d2 66 f7 74 04 3b 44 08 7d 37 fe c1 88 c5 |.1.f.t.;D.}7....|
00000140 30 c0 c1 e8 02 08 c1 88 d0 5a 88 c6 bb 00 70 8e |0........Z....p.|
00000150 c3 31 db b8 01 02 cd 13 72 1e 8c c3 60 1e b9 00 |.1......r...`...|
00000160 01 8e db 31 f6 bf 00 80 8e c6 fc f3 a5 1f 61 ff |...1..........a.|
00000170 26 5a 7c be 8e 7d eb 03 be 9d 7d e8 34 00 be a2 |&Z|..}....}.4...|
00000180 7d e8 2e 00 cd 18 eb fe 47 52 55 42 20 00 47 65 |}.......GRUB .Ge|
00000190 6f 6d 00 48 61 72 64 20 44 69 73 6b 00 52 65 61 |om.Hard Disk.Rea|
1+0 records in
1+0 records out
000001a0 64 00 20 45 72 72 6f 72 0d 0a 00 bb 01 00 b4 0e |d. Error........|
000001b0 cd 10 ac 3c 00 75 f4 c3 fd 76 f9 e5 00 00 80 20 |...<.u...v..... |
000001c0 21 00 83 c9 f8 91 00 08 00 00 00 f8 df 00 00 ea |!...............|
000001d0 d8 91 05 fe ff ff fe 07 e0 00 02 f0 1f 00 00 00 |................|
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
512 bytes copied, 0.0041475 s, 123 kB/s
00000200
</syntaxhighlight>
 
참고로 제 시스템의 파티션 정보는 다음과 같습니다.
 
<syntaxhighlight lang="bash">
root@debian-buster:~# parted -l
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 8590MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
 
Number Start End Size Type File system Flags
1 1049kB 7516MB 7515MB primary ext4 boot
2 7517MB 8589MB 1072MB extended
5 7517MB 8589MB 1072MB logical linux-swap(v1)
</syntaxhighlight>
 
<syntaxhighlight lang="bash">
root@debian-buster:~# fdisk -l
Disk /dev/sda: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe5f976fd
 
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 14680063 14678016 7G 83 Linux
/dev/sda2 14682110 16775167 2093058 1022M 5 Extended
/dev/sda5 14682112 16775167 2093056 1022M 82 Linux swap / Solaris
</syntaxhighlight>
리눅스의 부팅 과정은 어떻게 될까요? 간단하게 설명하자면 우선 바이오스에서 POST(Power-On Self-Test)를 수행합니다. 컴퓨터 주변 장치들에 이상이 없다면 바이오스는 MBR을 메모리에 적재합니다. MBR은 우리가 설치한 부트로더(bootloader)인 GRUB를 메모리를 적재합니다. GRUB는 커널을 메모리에 적재합니다. 커널은 디스크에 저장된 루트 파일 시스템(/)을 마운트합니다. <ref>https://www.ibm.com/developerworks/library/l-linuxboot/index.html</ref> <ref>https://0xax.gitbooks.io/linux-insides/content/Booting/linux-bootstrap-1.html</ref> <ref>https://www.thegeekstuff.com/2011/02/linux-boot-process/</reF> <ref>https://www.slashroot.in/linux-booting-process-step-step-tutorial-understanding-linux-boot-sequence</ref> <ref>https://www.reddit.com/r/explainlikeimfive/comments/5a4x8f/eli5_mbr_bootstrap_bootloader/</ref> <ref>https://www.computerhope.com/jargon/b/bootload.htm</ref>

둘러보기 메뉴