Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Mar 2004 09:29:52 -0500 (EST)
From:      Jerry McAllister <jerrymc@clunix.cl.msu.edu>
To:        brunoc@quipo.it
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Transferral between two hard disks
Message-ID:  <200403241429.i2OETsV23604@clunix.cl.msu.edu>
In-Reply-To: <005801c411a2$e51be040$d1015e3e@computer> from "Brunoc@quipo.it" at Mar 24, 2004 02:21:17 PM

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> Hi community,
> 
> I would like to transfer the contents of an hard disk
> partition,in which is installed FreeBSD (in another partition
> is installed NetBSD and another one is unused),to another hard disk.
> The recipient hard disk will have only FreeBSD,and is capable to get 
> all the data from the original.
> I guess I would perform such operation in a way like
> disk image software for Windows (System Commander,
> Norton Ghost) does.I've seen on previous postings the use
> of command like 'dd' or 'ioctl',but I don't know if they
> are appropriate or not.
> In a few words,my goal is to have a bootable hard disk 
> with my FreeBSD and data,like the original one,original one that 
> I'm going to use for other purposes.

Does the NetBSD also need to be bootable?

You really need to include the fdisk information too so we can see
what the slices actually are - note you have a FreeBSD 'slice'
not partition, in the FreeBSD world, and within that FreeBSD slice you 
have three partitions - a, b and e.   You say you also have a NetBSD slice
and an unused slice, but don't show anything.   The fdisk output would
at least show that.    do:
            fdisk -v da0 > fdisk.out  or fdisk -v ad0 > fdisk.out
Then include the contents of fdisk.out in the message.

Unless the new disk is identical in every way to the old one, you don't
want to bother with dd or any of the other so-called imaging utilities.  
Even if they are identical, they represent the less reliable way.

In general, I would recommend doing a fdisk on the new disk to make the
slices and then disklabel the FreeBSD slice and newfs the newly created
partitions.  When you do the fdisk, make the FreeBSD slice bootable and 
put an MBR on it and in disklabel put a standard boot block in the slice.  

Then use dump(8) and restore(8) to copy the contents of each separate
filesystem in the FreeBSD slice to the new filesystems on the new disk.
You do not need to use tape for the dump.  Just mount the new file system,
to some alternate mount point such as /newroot.  cd in to it and then
pipe a dump of the old file system to a full restore in the new one.
There used to be an example of this in the dump and restore man pages
but I don't see it now.  Maybe it was in man pages on another OS.
You only need to do this for the root (a) and other big file system (e) (is 
it mounted as /usr?)   Don't try to copy the swap partition.
This is the most reliable way.

Presuming that your e partition mounts as /usr
and you did the fdisk, disklabel and newfs of the new disk OK.
Also, presuming it is SCSI disk.  
If it is IDE, then da1s1a becomes ad1s1a, etc.

  recommend doing this in single user mode
  So, after rebooting in to single user.

  mount -a

  mkdir /newroot
  mount /dev/da1s1a /newroot
  cd /newroot
  dump 0af - / | restore -rf -
  mkdir /newusr
  mount /dev/da1s1e /newusr
  cd /newusr
  dump 0af - /usr | restore -rf -

Since you don't show anything about the NetBSD slice, it is hard to know
what to do with it.   You might actually be able to use the dump/restore
for it too if you can mount it in a running FreeBSD.   Of course, there
is no point in trying to copy the unused slice.

////jerry

> 
> FreeBSD seekingjob.singles.it 4.9-RC FreeBSD 4.9-RC #0: Wed Oct 15 00:12:26 CEST 2003     root@:/usr/obj/usr/src/sys/CURRENT_WITH_WINE_OPTIONS  i386
> -------------------------------------------------------------
> For complete information,even in the case you don't need it,
> I include the disklabel command output of my original 
> FreeBSD disk:
> 
> 8 partitions:
> #        size       offset           fstype                   [fsize bsize bps/cpg]
>   a:   163840        0             4.2BSD     1024  8192    16  # (Cyl.    0 - 10*)
>   b:   532480   163840      swap            # (Cyl.   10*- 46*)
>   c: 61432497        0          unused        0     0        # (Cyl.    0 - 4062*)
>   e: 60736177   696320    4.2BSD     1024  8192    16  # (Cyl.   46*- 4062*)
> 
>  /dev/ad2s1e:
> type: ESDI
> disk: ad2s1
> label: 
> flags:
> bytes/sector: 512
> sectors/track: 63
> tracks/cylinder: 240
> sectors/cylinder: 15120
> cylinders: 4062
> sectors/unit: 61432497
> rpm: 3600
> interleave: 1
> trackskew: 0
> cylinderskew: 0
> headswitch: 0  # milliseconds
> track-to-track seek: 0 # milliseconds
> drivedata: 0 
> -------------------------------------------
> Thank you
> Bruno
> 
> 
> ---
> [Quipo ISP - Questa E-mail e' stata controllata dal programma Declude Virus]
> [Quipo ISP - This E-mail was scanned for viruses by Declude Virus]
> 
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
> 
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403241429.i2OETsV23604>