Copy root filesystem from RAM to flash?
Hello,
I boot up a Linux appliance entirely in RAM, ie. the image has a Linux kernel and an attached ext2 root filesystem. Now that it's working, I would like to copy the root filesystem from RAM to a NAND flash memory. Can I just mount the NAND, run "cp -a /* /mnt/nand", reboot with the kernel command line "root=/dev/mtdblock2 rw", and expect Linux to be happy... or is it more involved than this? Thank you. |
edited
|
You can't copy a "live" running OS be it Linux, Windows, Unix, OSx or whatever as there are dynamic files which would fail to be copied correctly. This is assuming you could actually get the OS to copy! :) It would try to copy the process which is copying itself and would probably disappear up its own a....h Well, you get my drift?
That's why you would normally use a live CD to copy a HDD resident OS to another HDD. The source data is stable in this case. Play Bonny! :hattip: |
I posed this question about that on a gentoo live dvd. One suggestion was to rsync it and exclude a few folders.
Kind of wonder if it wouldn't be easier to use the original image. |
It might not be recommended, but the appliance comes with a shell script that does just this, ie. copy the whole directory tree from RAM to the NAND memory, excluding useless directories:
Code:
mount /dev/mtdblock2 /mnt |
"s /useless/troublesome/"
There are (potentially) issues with this, but done carefully is quite well understood. |
Quote:
Code:
!#/bin/bash |
Thanks Frieza for the script.
Quote:
|
See post #3 - you need to stay away from the pseudo filesystems.
|
Thanks for the tip. It's just a small root fs on an embedded Linux, but I'll update the root partition from Uboot + rootfs file.
|
All times are GMT -5. The time now is 11:56 PM. |