Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search

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.