User Tools

Site Tools


Raspberry pi emulator

I use raspberry pi emulator to build owncloud. See for installation. This is to avoid too much writing on SD card and breaking it too quickly.


You can connect through ssh to the emulator using the port redirection. The emulator redirects port 2222 to ssh standard port 22(using qemu parameter -redir tcp:2222::22) so to connect:

ssh -p 2222 pi@localhost

Increase root partition size

The image provided is too small, so I enlarged the disk and the root partition for the build. On your PC, add additionnal space by resizing the image file:

qemu-img resize "raspberry-pi-emulator-1.6/LINUX/Raspberry Pi Emulator/SharedSupport/2016-02-26-raspbian-jessie.img" +6G

Then in emulator on raspbian, install gparted:

sudo apt-get install gparted

Launch it from Menu after starting in graphical mode using startx command. Then resize partition to the maximum available. Shutdown emulator. After that, we will create devices from the image using kpartx, clean and resize the filesystem to the maximum:

sudo kpartx -a "raspberry-pi-emulator-1.6/LINUX/Raspberry Pi Emulator/SharedSupport/2016-02-26-raspbian-jessie.img"
sudo e2fsck -f /dev/mapper/loop0p2
sudo resize2fs /dev/mapper/loop0p2
sudo kpartx -d "raspberry-pi-emulator-1.6/LINUX/Raspberry Pi Emulator/SharedSupport/2016-02-26-raspbian-jessie.img"

Then, just restart the emulator: you can check new partition size using df command:

df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/root       9.5G  3.3G  5.8G  36% /
devtmpfs        125M     0  125M   0% /dev
tmpfs           125M     0  125M   0% /dev/shm
tmpfs           125M  4.5M  121M   4% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           125M     0  125M   0% /sys/fs/cgroup
tmpfs            25M     0   25M   0% /run/user/1000

Share this page:

raspberry_pi_emulator.txt · Last modified: 2016/06/03 22:11 by sgripon