Create TOC

2021년 10월 25일

img 파일 mount

raspberry pi OS의 /boot폴더가 손상될 경우 부팅이 안된다. 이때 새로 설치하지 않고 raspberry pi OS에서 /boot만 추출해서 복구해본다.

mount를 위해서 offset 값을 구해야 한다. 우선 fdisk 명령으로 시작 sector (Start)와 크기(Secror size)를 구한다.

$ sudo fdisk -l 2021-05-07-raspios-buster-armhf-lite.img
Disk 2021-05-07-raspios-buster-armhf-lite.img: 1.75 GiB, 1874853888 bytes, 3661824 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: 0x9730496b

Device                                    Boot  Start     End Sectors  Size Id Type
2021-05-07-raspios-buster-armhf-lite.img1        8192  532479  524288  256M  c W95 FAT32 (LBA)
2021-05-07-raspios-buster-armhf-lite.img2      532480 3661823 3129344  1.5G 83 Linux

8192에 512를 곱한 수를 offset으로 사용한다.

$ sudo mount -o loop,offset=$((8192*512)) 2021-05-07-raspios-buster-armhf-lite.img /mmt/test