John's Linux related stuff

Network Disk-copy

This is a simple method I used to copy an entire disk from one machine to another. I wanted to do a hardware upgrade, with as little down-time as possible, so I copied the entire root filesystem from one machine to another.

You need the netpipes package, which comes standard with Slakware. If you don't have it, get it from sunsite.

On the existing machine, type (as root)

# faucet 1234 -out tar -cvf - /


On the new machine, boot using an existing installation, or boot/root disk combination. You may need to build a static version of the hose program. Put it on a floppy and mount it. Mount the partition to become the new root as /mnt


# cd mnt
# umask 000
# hose 1234 -in tar --same-owner -xvpf -

And sit back while it copies. I found that it was quite fast, compated too other file transfer modes, such as FTP or SMB.

Make sure the uids and gids are set to the right values. You might have to use a tar option.


You can also use netpipes to create a CD image of your linux system, either for duplicating the system or as a backup.  Instead of untarring the result you write it to a file on your CD burner.  If your burner is a Windows machine then you can use my winhose.exe to download it.  When you create the CD you can either create an .iso image or write the tar file directly to the CD.  If you do the later then you will probably only be able to read it back from Linux which in most cases is not a problem.

Using SSH

You can also copy files like this using ssh.  This might be a bit slower but you get the advantages of authentication and encryption.

The destination machine only needs to be running a ssh server.  On the source machine/client, run the following command:

tar -cf - myfiles | ssh user@host "umask 000 ; tar -xpf -"

You could use use root@host but you have to make sure that your have enabled root logins via ssh.  It might be worth enabling root logins for this procedure and then turning it back off when you are finished.  Obviously to create files as other users, and to create device nodes etc. you must be root.

TODO: Is is possible to execute su on the remote end before sending through the tar data?

Last modified 20050826
Maintained by John Newbigin