Subject: Re: Tranferring a System
To: None <port-alpha@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: port-alpha
Date: 12/05/2001 04:27:38
In article <f05100331b8332fd44509@[130.102.20.138]>,
Ray Phillips <r.phillips@mailbox.uq.edu.au> wrote:
>Dear NetBSD/alpha:
>
>Is it possible to create a system disk by copying the contents of a 
>disk that has NetBSD installed on it to another one?
>
>I thought the following scheme might work, but I'm not sure how cp 
>will treat device files and sockets (and possibly other files I don't 
>understand).
>
>Assuming a working machine has one disk with / and /usr partitions, 
>create partitions on a second one, at least as large as those on the 
>first, and then (pardon the pseudo-code in the third line)...
>
># mount /dev/sd1a /mnt
># cd /
># cp -Rp ***list of files and directories in `/' except for usr*** /mnt
># umount /mnt
># mount /dev/sd1d /mnt
># cd /usr
># cp -Rp * /mnt
># umount /mnt
># /usr/mdec/installboot -v /dev/rsd1c /usr/mdec/bootxx_ffs
>
>Perhaps there's a recognised standard way of doing this that I don't 
>know about?  Can dd do it, even if the size of the partions on the 
>two disks are not the same?
>
dump and restore or tar is better so that you don't turn symlinks into
file copies, or fill sparse files and you don't have to worry about
skipping fs's.

mount /dev/sd1a /mnt
cd /
tar --one-file-system -czf - . | (cd /mnt && tar -xpzf -)

or:

mount /dev/sd1a /mnt
cd /mnt
dump 0f - /dev/rsd0a | restore -xf -

christos