Hard Drive Reshuffle

Gerald Combs gerald at ethereal.com
Fri Apr 18 14:47:15 CDT 2003


On Fri, 18 Apr 2003, Charles Steinkuehler wrote:

> If you're migrating to a new disk, it's easy enough to do this with tar 
> (rather than dd), which will keep all your hardlinks in place (if you 
> use rsync, hardlinks are turned into new files, increasing disk usage).

The question of copying files from one partition to another seems to come
up on the list every few months.  Maybe we should create a web a web page
listing all the wonderful ways that data can be copied under Linux and
Unix, and put that on the kclug web site.  I will seed the list thusly:

Tar:

    cd <source> ; tar cf - | (cd <destination> ; tar xpf - )

    Notes: 

      - Universal availablility.
      - Some (non-GNU) versions don't handle long paths well.

Pax:

    pax -rwpe <source> <destination>

    Notes:

      - Limited availability.  Too bad, since it works well.

Dump:

    dump 0f - <source> | (cd <destination> ; ufsrestore xf - )

    Notes:

      - Not recommended on Linux 2.4 or later kernels, unfortunately.
      - Source can be a device path - you can dump unmounted partitions.
      - Solaris commands are 'ufsdump' and 'ufsrestore'.  Other OSes have
        similar names for specific filesystems, e.g. xfsdump and advsdump.

Cpio:

    cd <source> ; find . -depth | cpio -pdlm <destination>

    Notes:

      - Spaces in filenames can cause problems.
      - Cpio is, like, sooo 80s.

Rsync:

    rsync -a <source> <destination>

    Notes:

      - Source and/or destination can be on remote machines.
      - Ssh can be used as a remote transport.
      - Rsync is very good at incremental updates.

Cp (GNU):

   cp -ar <source> <destination>

   Notes:

      - Special files (devices, etc.) not handled well.

Dd:

  dd if=<source> of=<destination>

  Notes:

    - Source is a device.  Destination is typically a device as well.
    - Copies the entire filesystem.

Moves, adds and changes are welcome.




More information about the Kclug mailing list