silent.gumph.org
Pages
  Welcome
  Basics of a quiet pc
  Quiet or Silent
  Boot Linux from CF
  Mini-Itx Comparison
  Diskless Windows
  Build a Media PC
  Silent PC Options
 
Reviews
  Cubid 2699R Case
  Kiss dp-500
  Zalman Flower Cooler
  AcoustiPack Foam
 
Books
  Build a PC Home Theater
  Build your own PC
  Upgrading and Repairing PCs
  Hardware Projects
 
Appendix
  Privacy policy
  About









Copying and Editing Files to filesystem Image
 

Now we need to copy the files from the hard drive (except /proc) onto the filesystem image. The following commands, assume you are using slackware, and no other drives/devices are mounted under /mnt
cp -a /bin /tmp/loop
cp -a /boot /tmp/loop
cp -a /dev /tmp/loop
cp -a /etc /tmp/loop
cp -a /home /tmp/loop
cp -a /lib /tmp/loop
cp -a /mnt /tmp/loop
mkdir /tmp/loop/proc
cp -a /root /tmp/loop
cp -a /sbin /tmp/loop
cp -a /usr /tmp/loop
cp -a /var /tmp/loop
If all goes according to plan, you should not have got any disk space warning messages, otherwise, start again with a larger filesystem image file.

We now need to edit some of the files so that it boots ok, starting with the /tmp/loop/etc/fstab file. This need to be changed, so it doesn't try mounting a hard drive. We need to change the line for the root mount point from something like

/dev/hda1    /      ext3     defaults    1   1
to this
/dev/fd2     /      ext2     defaults    1   1
So the ramdisk loads correctly. Make sure there are no lines for a swap disk, as the CF card won't be using one. Use whatever editor you are comfortable with. I use jed, because it's easy to use. If you are using slackware, and ext2 then we need to edit the /tmp/loop/etc/rc.d/rc.S file to stop it doing disk checks You need to remove the following chunk from the file
# Test to see if the root partition is read-only...
READWRITE=no
if echo -n >> "Testing filesystem status"; then
...
...
    read junk;
  fi
fi # Done checking root filesystem
So the file should now look like
...
...
# enable swapping
/sbin/swapon -a

# Code You Just Deleted

# Any /etc/mtab that exists here is old, so we delete ...
/bin/rm -f /etc/mtab*
# Remounting the / partition will initialize the new /etc/mtab:
/sbin/mount -w -o remount /
...
...
Remember we are editing the files on the filesystem image (/tmp/loop), not the live files in /etc, so we can always do it again, if we get it wrong.

Now unmount the filesystem image and compress it ready for copying onto the CF card.

umount /tmp/loop
gzip -c -9 /tmp/lite > /tmp/lite.gz
Once compressed, the filesystem image is usually only a third of its original size. This allows for a smaller CF card to be used if necessary. The image is compressed so it loads into memory faster from the CF card.

Creating A filesystem Image << Copying and Editing Files >> Setup CF Card

 
© 2003-2010 silent.gumph.org

Valid HTML 4.01! Valid CSS!