I've created a gentoo-live system which should be booted from a CF-card. The whole file-system is in a squashfs. I've created a custom initrd which first mounts the CF-card and from there the squashed filesystem into what will become /.

I'd like /etc to be writable so I've copied it to the CF-card added a bind. This however does not seem to work. The system boots but /etc is not mounted.

I'd like to know if my approach is right and what I can do to fix it or if not what would be the right way to achieve this.

Here's the init-script from my initrd:

#!/bin/busybox sh
mount -t proc none /proc
mount -t sysfs none /sys

mount /dev/sda1 /mnt/flash
mount -o loop /mnt/flash/filesystem.squashfs /mnt/root
mount -B /mnt/flash/etc /mnt/root/etc
mount -o remount,rw /mnt/root/etc

umount /proc
umount /sys

exec switch_root /mnt/root /sbin/init

This is the shortened output of cat /proc/mounts:

rootfs / rootfs rw 0 0
/dev/sda1 /mnt/flash ext2 rw,relatime,errors=continue,user_xattr,acl 0 0
/dev/loop0 / squashfs ro,relatime 0 0
  • Just to be clear, you want changes to /etc to be stored on the CF card to persist across boots? Is the /etc dir from the card not mounted at all (what's the output of cat /proc/mounts?), or only read-only? – depquid Mar 19 '13 at 15:48
  • You got it right. I want the changes to /etc persisted. It seems /etc is not mounted at all. – Anonymous Coward Mar 19 '13 at 16:04

BusyBox's built-in mount command doesn't recognize -B; you'll have to use -o bind:

mount -o bind /mnt/flash/etc /mnt/root/etc

Also, I think the remounting is unnecessary if /mnt/flash is already writable. But try fixing the bind mounting first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.