[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Copying Linux to a new drive



On Tue, 31 Jul 2001, Willi Dyck wrote:

> I would like to know if tar handels the device files right!

It looks like it.  I am making a root-raid system.  I have created my
raid arrays, formatted and mounted them under /mnt/raid in the same
hierarchy as they will be mounted once the system is complete.
Then:

earth:~# cd /
earth:/# tar cpf - dev | tar xvpf - -C /mnt/raid
earth:/# ls -l /dev/md[0-3]
brw-rw----    1 root     disk       9,   0 Jul 29 12:45 /dev/md0
brw-rw----    1 root     disk       9,   1 Jul 29 12:45 /dev/md1
brw-rw----    1 root     disk       9,   2 Jul 29 12:45 /dev/md2
brw-rw----    1 root     disk       9,   3 Jul 29 12:45 /dev/md3
earth:/# ls -l /mnt/raid/dev/md[0-3]
brw-rw----    1 root     disk       9,   0 Jul 29 12:45 /mnt/raid/dev/md0
brw-rw----    1 root     disk       9,   1 Jul 29 12:45 /mnt/raid/dev/md1
brw-rw----    1 root     disk       9,   2 Jul 29 12:45 /mnt/raid/dev/md2
brw-rw----    1 root     disk       9,   3 Jul 29 12:45 /mnt/raid/dev/md3

It looks OK to me (thanks for getting me to check; I didn't think about
the device files, I was more worried about permissions and owners).

I proceed similarly for all top-level directories in /, changing only the
source dir. name for each command:

earth:/# tar cpf - bin | tar xvpf - -C /mnt/raid
earth:/# tar cpf - boot | tar xvpf - -C /mnt/raid

etc., except for /proc and /mnt, for obvious reasons:

earth:/# mkdir /mnt/raid/proc
earth:/# mkdir /mnt/raid/mnt

This is also the reason why this won't work: 
earth:/# cd /
earth:/# tar cpf - . | tar xvpf - -C /mnt/raid

You do need the separate commands for each dir.

Since the target filesystems are mounted, everything ends up in the right
place without worrying about only tarring in the source filesystem,
changing working dirs. etc.  I am very lazy, I can be very absent-minded,
and my typing is awful... :) so this is what I do to make my life easy.

It "seems to work"(TM); i was just worried that I was overlooking
something (cf. "No; it can't be that easy; this is UNIX, after all... :) )

Best regards,

George Karaolides       8, Costakis Pantelides St.,
tel:   +35 79 68 08 86                   Strovolos, 
email: george@karaolides.com       Nicosia CY 2057,
web:   www.karaolides.com      Republic  of Cyprus





Reply to: