lukechilds / dockerpi

A Virtualised Raspberry Pi inside a Docker image
MIT License
1.76k stars 181 forks source link

Default disk space is too small? #39

Open CamDavidsonPilon opened 3 years ago

CamDavidsonPilon commented 3 years ago

Hi, I'm new to docker and qemu, so I maybe missing something. When I follow your install instructions, specifically docker run -it lukechilds/dockerpi, and log into the Rpi, there is a very small disk space:

pi@raspberrypi:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.8G  1.2G  533M  69% /
devtmpfs        124M     0  124M   0% /dev
tmpfs           124M     0  124M   0% /dev/shm
tmpfs           124M  1.9M  122M   2% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           124M     0  124M   0% /sys/fs/cgroup
/dev/sda1       253M   52M  201M  21% /boot
tmpfs            25M     0   25M   0% /run/user/1000

How can I give move space to the Rpi? I saw #18, but I don't understand how that solution is implemented.

lupodellasleppa commented 3 years ago

Hello,

I don't know about the default image, but you can try sudo raspi-config and under Advanced options you have Resize filesystem. You let it do its thing and after the next reboot it will have expanded to all available space (the size of the .img file).

If you intend to use a custom .img file, you first need to bring that to the size you want. You can use qemu-img for that.

Suppose you have your-raspios-img-file.img which is 2GB and you want to bring it up to 4GB:

qemu-img resize your-raspios-img-file.img 4G

Then you launch dockerpi with that image as filesystem and expand the filesystem using raspi-config, at next boot you'll have 4GB

cdupont commented 3 years ago

I tried to expand the image size using raspi-config. I go "Advanced Option"/"Expand File System" but it says "sda2 is not an SD card. Don't know how to expand"

CamDavidsonPilon commented 3 years ago

This answer may help: https://stackoverflow.com/questions/68101936/how-to-increase-the-size-of-dev-root-on-a-docker-image-on-a-raspberry-pi/68328492#68328492