For any anyone interested, I have found a way to load a running instance of voyage linux into ram, all while connected over ssh. It means that you can reflash or even repartition the CF card remotely.
The instructions are written for a WRAP box, but could be varied for something else. When I get time I'll put this up on the wiki. Cheers, Rasjid. ----------------------------------------------- Moving the root filesystem to a ram tmpfs via ssh. 0) Log in via ssh NOTE: if testing this 'at home', make sure you ARE NOT logged in as a user via the serial port, although you can be viewing the serial port output if you wish. 1) apt-get install lsof (remountrw first) 2) if required, tidy up voyage - clear apt-get cache etc. 3) stop all unnecessary services cd /etc/init.d/ ./pptpd stop ./cron stop ./inetd stop ./dnsmasq stop 4) mkdir /oldroot & mkdir /newroot remountrw mkdir /oldroot mkdir /newroot remountro 5) create the tmpfs filesystem mount -t tmpfs -o size=xxM tmpfs /newroot where xxM is a bit over half of the current size of / 6) copy over existing root filesystem and perform pivot cp -ax / /newroot cd /newroot pivot_root . oldroot exec chroot . sh 7) remount virtual filesystems on new root system mount -t proc proc /proc mount -t sysfs sysfs /sys mount -t devpts devpts /dev/pts 8) copy over /rw mount /rw cp -ax /oldroot/rw/* /rw 9) stop and start all processes on the new root filesystem ## Simple and quick but more risky ## edit /etc/inittab - comment out ~~:S:wait:/sbin/sulogin ## # telinit 1; sleep 20; telinit 2 ## reconnect via ssh - but if something has gone wrong, ## and you can't log in, a reset of the box will be required # Longer method - always remaining connected via ssh /etc/init.d/ssh restart Log in again (2nd instance) via ssh Log out of original ssh instance killall getty killall syslogd /etc/init.d/syslogd start killall klogd /etc/init.d/klogd start /etc/init.d/watchdog restart killall dhclient # if getting IP via dhcp # end long method telinit u # check for anything still on oldroot lsof -n | grep oldroot stop any processed with files open on oldroot 10) unmount all old filesystems cd /oldroot umount proc umount sys umount dev/pts umount dev/shm umount grub umount rw cd / umount /oldroot 11) Done! You can now do anything you want on the CF card, including repartition etc. WARNING: If you are in the middle of reflashing the card and the power fails, the box may only be recoverable with physical access. _______________________________________________ Voyage-linux mailing list [email protected] http://list.voyage.hk/mailman/listinfo/voyage-linux
