CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" >

7. Extending the solution

7.1. Saving and restoring files instead of file systems

If you don't want to save a whole disk image just the files within the file system, you can use a similar solution but with tar or cpio instead of dd. Also you need to mount the file system. More commands should be added to the clone script as shown below.

# mkdir /mnt
# mount ${device_name} /mnt
# mknod ${image} p
# tftp ${tftp_server} <<-EOT &
binary
put ${image}
EOT
tar czf ${image}
			

or

# tftp ${tftp_server} <<-EOT &
binary
get ${image}
EOT
tar xzf ${image}
			

You have to put the mkdir and tar programs in the initrd image so that the script can use them.

7.2. Setting up the master boot record

In a situation where you used this setup to reorganize and resize your partitions, you may end up with a disk that doesn't boot. Running the setup command from Grub (including the grub program in the image) should resolve the situation. See the Grub documentation for details.

7.3. Loading necessary modules

Depending on your kernel, additional modules may be necessary to access some block devices like SCSI devices. Just put the necessary modules in the /lib directory of the initrd image and the correspondent insmod commands in the clone script. The same applies for file systems. If, for instance, you want save the files instead of the image of a fat file system you will need the fat.o and vfat.o modules.

7.4. Predefined operations on grub.conf

The Grub menu file grub.conf may be customized to present a few copy options or even execute a predefined operation such as repartitioning the disk and retrieving specified images from network. Again, you can use the concepts presented here to achieve a specific application.