Skip to contentSkip to conversation

Unable to create files inside mounted root filesystem

Buildroot Adam McLaurin 3 participants 7 messages Oct 27, 2008

lore
Share & tools
lore
#0 lore raw

Hi all,

I hope this is a typical newbie question. I was finally able to create a root filesystem (ext2) with buildroot, and I can mount (-o loop) and chroot into it with no problems.

The trouble is that I cannot create any files in the mounted filesystem:
/ # touch foo
touch: foo: No space left on device

Strangely, when I mount/chroot into one of the pre-built root filesystems available from the uclibc website, I can create files without any problems.

I'm trying to figure out what I did differently creating my root filesystem that would cause this problem, but at the moment I'm out of ideas.

Any advice?

Thanks,
Adam

#1 lore raw

2008/10/27 Adam McLaurin <[email protected]>:

Quoted 14 lines

Hi all,

I hope this is a typical newbie question. I was finally able to create a root filesystem (ext2) with buildroot, and I can mount (-o loop) and chroot into it with no problems.

The trouble is that I cannot create any files in the mounted filesystem:
/ # touch foo
touch: foo: No space left on device

Strangely, when I mount/chroot into one of the pre-built root filesystems available from the uclibc website, I can create files without any problems.

Quoted 6 lines

I'm trying to figure out what I did differently creating my root filesystem that would cause this problem, but at the moment I'm out of ideas.

Any advice?

Welcome, I am newbie in buildroot me too, try this:

mount -o remount,rw /

It was useful in my bootable iso9660 from buildroot

Cheers,

Signature · 1 line
/roberto
#2 lore raw
Quoted 8 lines · Roberto A. Foglietta

2008/10/27 Adam McLaurin <[email protected]>:
Welcome, I am newbie in buildroot me too, try this:

mount -o remount,rw /

It was useful in my bootable iso9660 from buildroot

Cheers,

Thanks for the advice. I tried what you suggested, but no luck:
/ # mount -o remount,rw /
mount: cannot read /proc/mounts: No such file or directory

Indeed, /proc is entirely empty. However, it is also empty when I mount the pre-built filesystem (from uclibc's website), so I don't think that's a problem.

-Adam

#3 lore raw
In reply to Adam McLaurin
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Adam" == Adam McLaurin <[email protected]> writes:

Hi,

Adam> I hope this is a typical newbie question. I was finally able to Adam> create a root filesystem (ext2) with buildroot, and I can mount Adam> (-o loop) and chroot into it with no problems.

Adam> The trouble is that I cannot create any files in the mounted Adam> filesystem: / # touch foo touch: foo: No space left on device

That's because genext2fs only creates the file system exactly big enough for the buildroot files. If you want to have room for more stuff take a look at the BR2_TARGET_ROOTFS_EXT2_BLOCKS/INODES options:

#4 lore raw
Quoted 11 lines · Peter Korsgaard

That's because genext2fs only creates the file system exactly big enough for the buildroot files. If you want to have room for more stuff take a look at the BR2_TARGET_ROOTFS_EXT2_BLOCKS/INODES options:

From target/ext2/Config.in:

config BR2_TARGET_ROOTFS_EXT2_BLOCKS
int "size in blocks (leave at 0 for auto calculation)" depends on BR2_TARGET_ROOTFS_EXT2
default 0

Quoted 4 lines

config BR2_TARGET_ROOTFS_EXT2_INODES
int "inodes (leave at 0 for auto calculation)" depends on BR2_TARGET_ROOTFS_EXT2 default 0

Yep, that was indeed the problem. However, it's not really clear to me how the block size is computed by genext2fs, so it's hard to know exactly how many blocks to allocate. I took a guess at 204088 blocks and 100000 inodes, which is probably overkill but seems to work.

Anyway, thanks for the advice!

-Adam

#5 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Adam" == Adam McLaurin <[email protected]> writes:

Hi,

Quoted 9 lines
Quoted 9 lines

config BR2_TARGET_ROOTFS_EXT2_BLOCKS
int "size in blocks (leave at 0 for auto calculation)" depends on BR2_TARGET_ROOTFS_EXT2
default 0

config BR2_TARGET_ROOTFS_EXT2_INODES
int "inodes (leave at 0 for auto calculation)"
depends on BR2_TARGET_ROOTFS_EXT2
default 0

Adam> Yep, that was indeed the problem. However, it's not really Adam> clear to me how the block size is computed by genext2fs, so Adam> it's hard to know exactly how many blocks to allocate. I took a Adam> guess at 204088 blocks and 100000 inodes, which is probably Adam> overkill but seems to work.

True. Those options are forwarded directly to genext2fs (-b and -N options), so have a look at the man page of genext2fs for details.

Signature · 1 line
Bye, Peter Korsgaard
#6 lore raw
Quoted 2 lines · Peter Korsgaard

True. Those options are forwarded directly to genext2fs (-b and -N options), so have a look at the man page of genext2fs for details.

Well the documentation doesn't even mention block size, but fortunately the source code is more revealing:
#define BLOCKSIZE 1024

-Adam