Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more free space to rootfs-tools.ext2 #32

Closed
edubart opened this issue Jan 8, 2024 · 5 comments
Closed

Add more free space to rootfs-tools.ext2 #32

edubart opened this issue Jan 8, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@edubart
Copy link
Contributor

edubart commented Jan 8, 2024

Context

When trying to do apt-get update with VirtIO networking device using rootfs-tools-v0.14.1.ext2, it fails because the disk is out of space. We need to provide a rootfs with a bit more space for testing things out.

Possible solutions

Right now the rootfs has 4MB of free space, we could provide at least 64MB of free space.

@mpolitzer
Copy link
Collaborator

We can add this to the docs:

$ resize2fs <image> <new-size>
$ resize2fs image.ext2 160M # i.e

@vfusco vfusco self-assigned this Feb 23, 2024
@edubart edubart linked a pull request Mar 19, 2024 that will close this issue
@edubart edubart assigned edubart and unassigned vfusco Mar 19, 2024
@edubart edubart moved this from Todo to PR Available in Machine Emulator SDK Mar 19, 2024
@edubart
Copy link
Contributor Author

edubart commented Mar 29, 2024

The currently rootfs is so small that you can't even run apt-get update, so everyone willing to use VirtIO with --network and --volume options to quickly experiment running their software inside the machine will have to copy himself a rootfs.ext2 and go to the resize2fs tool.

The idea is the following (for convenience):

  1. User download cartesi-machine binary package (comes with rootfs, kernel, everything).
  2. User just open cartesi-machine -n -v .:/mnt -it bash.
  3. User install what he needs eg, with apt-get update && apt-get install python
  4. User starts editing hello.py for example on a host file editor, then just run python /mnt/hello.py inside the machine terminal, to test inside cartesi machine environment.

Using resize2fs would add new complicated steps to this, and make more difficult to try things for the first time.

@diegonehab
Copy link
Contributor

We can close this, right? There is a simple way to increase its size using cartesi-machine.lua itself.

[diego@pascal ~/cartesi/sdk/emulator/src {feature/rollup-rework}] du -sch rootfs.ext2
112M    rootfs.ext2
112M    total
[diego@pascal ~/cartesi/sdk/emulator/src {feature/rollup-rework}] ./cartesi-machine.lua --quiet --no-init-splash -- df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        97M   89M  3.5M  97% /
tmpfs            57M     0   57M   0% /dev/shm
tmpfs            57M     0   57M   0% /tmp
tmpfs            57M  4.0K   57M   1% /run
[diego@pascal ~/cartesi/sdk/emulator/src {feature/rollup-rework}] truncate -s 200M rootfs.ext2
[diego@pascal ~/cartesi/sdk/emulator/src {feature/rollup-rework}] ./cartesi-machine.lua --quiet --no-init-splash --flash-drive=label:grow,mount:false,filename:rootfs.ext2,shared --append-init="USER=root" -- resize2fs /dev/pmem1
resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on /dev/pmem1 to 51200 (4k) blocks.
The filesystem on /dev/pmem1 is now 51200 (4k) blocks long.
[diego@pascal ~/cartesi/sdk/emulator/src {feature/rollup-rework}] ./cartesi-machine.lua --quiet --no-init-splash -- df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       194M   89M   96M  49% /
tmpfs            57M     0   57M   0% /dev/shm
tmpfs            57M     0   57M   0% /tmp
tmpfs            57M  4.0K   57M   1% /run

@edubart
Copy link
Contributor Author

edubart commented May 6, 2024

I don't know. I still stand that we should provide this rootfs in cartesi machine official packages with enough space to play with it. The idea is to allow this once we have Ubuntu packages:

Suppose I want to test if the cartesi machine can run my script myscript.py:

apt-get install cartesi-machine-sdk
cartesi-machine -v=.:/mnt -u=root -n -it bash
apt-get update -y
apt-get install -y python
python /mnt/myscript.py

Not having space will make users' lives less convenient. I use the cartesi machine instead of Docker run to try things out here. Although I have to patch rootfs to increase its size. Not having a larger size every user will also need to do the same. It will be more problematic with packages, because they can't edit things in /usr/share..

@edubart
Copy link
Contributor Author

edubart commented May 6, 2024

Well maybe we could provide rootfs packages with different flavors, one of them would just have more space so you can play, more things to maintain, but it's another approach.

Since we don't distribute Linux packages for the host yet, nor encourage people to play with installing packages outside Docker (with cartesi machine cli), I am closing.

@edubart edubart closed this as completed May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants