[Arm-netbook] pivot_rooting to Debian (was Re: Repartitioning the internal flash)
Oliver Kiddle
okiddle at yahoo.co.uk
Fri Mar 5 01:34:52 GMT 2010
Luke Kenneth Casson Leighton wrote:
> the other alternative to consider is creating a ram disk, putting a
> tiny rootfs environment in it and then pivot_rooting into it.
What about pivot_rooting onto the SD card?
It'd potentially allow a choice between MOS and Debian by simply
removing/inserting the SD card on boot. My only other use for the SDÂ card
slot is likely to be viewing photos from my camera so I'd just have to
put up with doing that from MOS.
Getting a working ext4 filesystem isn't easy. First, I built the latest
e2fsprogs. After using mkfs.ext4 on /dev/mmcblk1p1, mount returns EINVAL.
Finally I got something to mount by creating my filesystem with:
dd if=/dev/mmcblk0p3 of=/dev/mmcblk1p1
I then used resize2fs to make this bigger. Result is only 7.2G in size
which seems a bit low for an 8G SD card so if anyone has any good ideas
on formatting properly, I'd be interested.
I've tested the pivot_root concept using VirtualBox on my PC with a
Fedora install on a second disc (using febootstrap). I'm using the
following init script partly taken from the pivot_root man page:
#!/bin/sh
if [ $$ -eq 1 ]; then
# use /dev/mmcblk1p1
if /bin/mount -t ext3 /dev/hdb1 /mnt && [ -x /mnt/sbin/init ]; then
cd /mnt
pivot_root . old_root
exec chroot . sh -c 'umount /old_root; exec /sbin/init' \
< dev/console > dev/console 2>&1
fi
fi
exec /sbin/init.orig "$@"
This works. Only thing is that on boot I'm getting a prompt about whether
I really want to run e2fsck on a mounted filesystem (root). Any idea
how I'd avoid that because it'd be bad when I don't have access to
the console. Not putting the rootfs in /etc/fstab avoids this but then
df doesn't work.
Before I stick this on my netbook, does anyone have any suggestions for
improvements or foresee any problems? Can I perhaps check something in
/sys before trying the mount or will that not be there yet. Should I do
anything for /dev?
Oliver
More information about the Arm-netbook
mailing list