<HTML ><HEAD ><TITLE >Extending the solution</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ "><LINK REL="HOME" TITLE="HOWTO Clone Disk Images on Linux Booted from a Network" HREF="index.html"><LINK REL="PREVIOUS" TITLE="Running the clone script" HREF="running.html"><LINK REL="NEXT" TITLE="List of files on initrd" HREF="initrdfiles.html"></HEAD ><BODY CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >HOWTO Clone Disk Images on Linux Booted from a Network</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="running.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="initrdfiles.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="EXTENDING">7. Extending the solution</H1 ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN305">7.1. Saving and restoring files instead of file systems</H2 ><P >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 <B CLASS="COMMAND" >tar</B > or <B CLASS="COMMAND" >cpio</B > instead of <B CLASS="COMMAND" >dd</B >. Also you need to mount the file system. More commands should be added to the clone script as shown below.</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="PROGRAMLISTING" ><TT CLASS="PROMPT" ># </TT >mkdir /mnt <TT CLASS="PROMPT" ># </TT >mount ${device_name} /mnt <TT CLASS="PROMPT" ># </TT >mknod ${image} p <TT CLASS="PROMPT" ># </TT >tftp ${tftp_server} <<-EOT & binary put ${image} EOT tar czf ${image} </PRE ></FONT ></TD ></TR ></TABLE ><P >or</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="PROGRAMLISTING" ><TT CLASS="PROMPT" ># </TT >tftp ${tftp_server} <<-EOT & binary get ${image} EOT tar xzf ${image} </PRE ></FONT ></TD ></TR ></TABLE ><P >You have to put the <B CLASS="COMMAND" >mkdir</B > and <B CLASS="COMMAND" >tar</B > programs in the initrd image so that the script can use them.</P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN322">7.2. Setting up the master boot record</H2 ><P >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 <B CLASS="COMMAND" >setup</B > command from Grub (including the <B CLASS="COMMAND" >grub</B > program in the image) should resolve the situation. See the Grub documentation for details.</P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN327">7.3. Loading necessary modules</H2 ><P >Depending on your kernel, additional modules may be necessary to access some block devices like SCSI devices. Just put the necessary modules in the <TT CLASS="FILENAME" >/lib</TT > directory of the initrd image and the correspondent <B CLASS="COMMAND" >insmod</B > 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 <EM >fat</EM > file system you will need the <TT CLASS="FILENAME" >fat.o</TT > and <TT CLASS="FILENAME" >vfat.o</TT > modules.</P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN335">7.4. Predefined operations on <TT CLASS="FILENAME" >grub.conf</TT ></H2 ><P >The Grub menu file <TT CLASS="FILENAME" >grub.conf</TT > 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.</P ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="running.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="initrdfiles.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Running the clone script</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >List of files on initrd</TD ></TR ></TABLE ></DIV ></BODY ></HTML >