Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
...
share|improve this question
    
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

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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