OS 이미지 안의 특정 파티션을 마운트 하는 방법
HOWTO: Virtual Raspbian on Qemu in Ubuntu Linux 12.10
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=37386
$ mkdir ~/qemu_vms/
Download/copy Raspbian Wheezy to ~/qemu_vms/
Download kernel-qemu to ~/qemu_vms/
$ sudo apt-get install qemu-system
$ file ~/qemu_vms/2013-02-09-wheezy-raspbian.img
From the output of the file command, take the partition 2 'startsector' value an multiply by 512, and use this figure as the offset value in the mount command below.
$ sudo mount ~/qemu_vms/2013-02-09-wheezy-raspbian.img -o offset=62914560 /mnt
$ sudo nano /mnt/etc/ld.so.preload
Comment out the line in the file (use a # as the first character of the line) and save the file (CTRL+X, then "Y" for yes).
$ sudo umount ~/qemu_vms/2013-02-09-wheezy-raspbian.img /mnt
$ cd ~/qemu_vms/
$ qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1" -hda ~/qemu_vms/2013-02-09-wheezy-raspbian.img -redir tcp:5022::22
Qemu gives you a root shell, run:
$ fsck /dev/sda2
$ shutdown -r now
Login as pi
Password raspberry
여기서 주목하는 부분은
$ sudo mount ~/qemu_vms/2013-02-09-wheezy-raspbian.img -o offset=62914560 /mnt
이 구문이다.
*.img 파일은 sd 카드를 통째로 이미지화한 파일이기 때문에 그 안에 파티션도 나뉘어 들어있다.
이런 부분은 offset=???? 을 사용해서 원하는 위치의 파티션에서부터 마운트 가능하도록 하는 명령이다.
mercury RaspberryPi # fdisk -l 2013-02-09-wheezy-raspbian.img
Disk 2013-02-09-wheezy-raspbian.img: 1939 MB, 1939865600 bytes, 3788800 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
Disk identifier: 0x00014d34
Device Boot Start End Blocks Id System
2013-02-09-wheezy-raspbian.img1 8192 122879 57344 c W95 FAT32 (LBA)
2013-02-09-wheezy-raspbian.img2 122880 3788799 1832960 83 Linux
1 블럭은 512 바이트