Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

cloning laptop drives

0 views
Skip to first unread message

kjerste soderberg

unread,
Sep 27, 2001, 9:59:26 PM9/27/01
to
sanity check, pls tell me if this is right

In short; booting off of ad0 and want to clone ad1
ad1 is blank and is IDENTICAL (SAME SIZE & GEOMETRY &
MFR ) drive as ad0

can I be root and do?

dd if=/dev/ad0 of=/dev/ad1

running FBSD 4.3-REL

tried it and it seeems to just sit there forever, dd
never comes back, the red LED drive light lights up
and stays lit BUT no activity on it, I mean it doesn't
hang or anything & I can ctrl-C out of it but it
doesn't work?? I do top and dd isn't even there ..

Should I drop out of multi-user into single-user
mode??
(I gotta hit the handbook on how to do that..) or
something like that? I must be missin somethin here..


Thanx for ANY & ALL help !

__________________________________________________
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com

To Unsubscribe: send mail to majo...@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message

Edwin Culp

unread,
Sep 27, 2001, 10:08:14 PM9/27/01
to
AFAIK, the default for dd is one block at a time and that can take for ever.
You need to define the block size to something much larger. I have seen some
cool formulas based on disk geometry but I never seem to remember them when
I need them.:-( You might try something like

dd if=/dev/ad0 of=/dev/ad1 bs=8192

Hopefully someone will give you a better number.

ed

Quoting kjerste soderberg <kjer...@yahoo.com>:


---

kjerste soderberg

unread,
Sep 27, 2001, 11:00:21 PM9/27/01
to
SO you mean move to yet another machine and say boot
off of say scsi da1 ? then do as root;
dd if=/dev/ad1 of=/dev/ad2 bs=1m

would work? the bs I'm assuming is 1 meg size block
taken from previous answer to my post?

Again I thank ALL respondents ...

--- Marc Rassbach <ma...@milestonerdl.com> wrote:
> The issue is the booting off the one drive.
>
> Move both to a 3rd drived machine

Daniel O'Connor

unread,
Sep 28, 2001, 2:17:18 AM9/28/01
to

On 28-Sep-2001 Edwin Culp wrote:
> AFAIK, the default for dd is one block at a time and that can take for ever.
> You need to define the block size to something much larger. I have seen
> some
> cool formulas based on disk geometry but I never seem to remember them when
> I need them.:-( You might try something like
>
> dd if=/dev/ad0 of=/dev/ad1 bs=8192
>
> Hopefully someone will give you a better number.

I usually pick 64k when doing this..

Also, if those drives are on the same chain the performance is going to suck
really hard..

If you hit 'ctrl-t' you will get some info on dd's progress, and if you run
'systat -vmstat 1' and look at the bottom section you'll see the transfer
speeds.

---
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum

Robert Gray

unread,
Sep 28, 2001, 10:18:46 AM9/28/01
to
Yes, like Daniel says, large block sizes (I use 32K or 64K)
and separate IDE controllers make a huge difference.

You may as well use the "raw" devices to transfer directly
into user space.

One further tip, /usr/ports/misc/buffer, can double the
speed because it forks into two processes connected
via shared memory - a reader and a writer, each operating
as fast as the disks can respectively read or write.
In contrast, dd waits for a read to complete before starting a write.
Buffer also prints progress so you know how long it will take.

Here is approximately what I use:
buffer -s 32k -S 1m </dev/rad0 >/dev/rad1
-s is the block size
-S prints out progress

"Daniel O'Connor" <doco...@gsoft.com.au> Fri, 28 Sep 2001 15:46:43 +0930 says:
>
>On 28-Sep-2001 Edwin Culp wrote:
>> AFAIK, the default for dd is one block at a time and that can take for ever
>.
>> You need to define the block size to something much larger. I have seen
>> some
>> cool formulas based on disk geometry but I never seem to remember them when
>> I need them.:-( You might try something like
>>
>> dd if=/dev/ad0 of=/dev/ad1 bs=8192
>>
>> Hopefully someone will give you a better number.
>
>I usually pick 64k when doing this..
>
>Also, if those drives are on the same chain the performance is going to suck
>really hard..
>
>If you hit 'ctrl-t' you will get some info on dd's progress, and if you run
>'systat -vmstat 1' and look at the bottom section you'll see the transfer
>speeds.

To Unsubscribe: send mail to majo...@FreeBSD.org

Andy Sparrow

unread,
Sep 28, 2001, 11:54:58 AM9/28/01
to

You can happily clone off a disk with mounted filesystems, and write to
another drive. However, note that this isn't ideal - you'll at least need to
fsck the target filesystem afterward (e.g. on booting from it), and you might
just be unlucky (e.g. something might be hosed). Far better to have it
unmounted when you clone from the source - then you should get a good copy.

As others have noted, you need to use a vastly larger block size for better
performance. I was getting good results with bs=1024k (e.g. 1Mb) for cloning
18Gb SCSI root drives. Admittedly completely different hardware, YMMV. The
default block size would have taken forever, BTW.

Maybe the best scenario would be to remove both drives, place them in another
machine (e.g. a desktop with a couple of 2.5"->3.5" adaptors), boot from yet
another controller channel/drive and do the transfer that way. Lot of messing
about - but possibly worth it if you don't trust the laptop hardware for some
reason?

Most laptops that support more than one disk already put them as masters on
different controllers (least, the ones I've seen do), so why don't you boot
from the FreeBSD CD/install floppies, and do the cloning from Rescue mode?

You wouldn't need to remove/mess about with the hardware, all the filesystems
on your source drive are completely unmounted and thus quiescent. This is the
way I'd probably go.

I would also note that I've had 2.5" drives that seem to run fine (and so does
the OS on them), yet they won't clone satisfactorily. However, these were
older drives (300mb!!) and were probably genuinely suspect - modern stuff
should behave rather better, I expect.

If your stuff is older, try listening to make sure that the drive isn't
recalibrating if it is taking too long, and check for driver/disk timeout or
error messages.

Good luck!

Cheers,

AS


> SO you mean move to yet another machine and say boot
> off of say scsi da1 ? then do as root;
> dd if=/dev/ad1 of=/dev/ad2 bs=1m
>
> would work? the bs I'm assuming is 1 meg size block
> taken from previous answer to my post?
>
> Again I thank ALL respondents ...

kjerste soderberg

unread,
Sep 28, 2001, 12:36:12 PM9/28/01
to
Ok then
Thanx for ALL the great advice here,

From what I'm getting from all your instructions
here's what I'll be doing for these laptops.

Mounting drives in another machine
source=/dev/ad1
target=/dev/ad2
target=/dev/ad3
(I'll be mounting 2 targets at a time until all 20 or
so drives are finished)

Install the buffer port, then as root do;
buffer -s 32k -S 1m </dev/ad1 >/dev/ad2

(for target ad2 and would I chg the 32k to 1024k for a
1meg buffer?)
then;

dd if=/dev/ad1 of=/dev/ad2 bs=1024k

I put ad1 on primary ide channel and ad2 &3 on sec ide
channel.

I hit 'ctrl-t' to get info on dd progress

and I can do in separate term
systat -vmstat 1

and I look at the bottom section for me to see the
transfer speeds.

Again I'm just confirming your instructions to see if
I got it right ..

Thanx again.

__________________________________________________
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com

To Unsubscribe: send mail to majo...@FreeBSD.org

Kevin Oberman

unread,
Sep 28, 2001, 1:06:25 PM9/28/01
to
> From: Robert Gray <b...@cs.colorado.edu>
> Date: Fri, 28 Sep 2001 08:18:01 -0600
> Sender: owner-free...@FreeBSD.ORG

>
> Yes, like Daniel says, large block sizes (I use 32K or 64K)
> and separate IDE controllers make a huge difference.
>
> You may as well use the "raw" devices to transfer directly
> into user space.

Very minor nit, but in FreeBSD 4.3 the raw and cooked devices are
really the same thing, so it really makes no difference if you use
/dev/ad0 or /dev/rad0.

R. Kevin Oberman, Network Engineer
Energy Sciences Network (ESnet)
Ernest O. Lawrence Berkeley National Laboratory (Berkeley Lab)
E-mail: obe...@es.net Phone: +1 510 486-8634

kjerste soderberg

unread,
Sep 28, 2001, 8:40:39 PM9/28/01
to
OK I AM NOW FINISHED with this issue
my thanx to ALL respondents.
Truly world class tech suppt delivered promptly.

Here's what I settled on and it is presently working
fine and I can transfer 15.2MB/sec
so cloning each 20GB drive is taking on ave 20min
approx.

I am posting this final note for future reference by
future generations who will run into same problems
when "mass-producing" FBSD or any unix.
Again thanx to all, pls see Kevin's response below for
more valuable insights, and with this last response in
mind here's the documented procedure.

--CLONING IDENTICAL DRIVES WITH dd--
Doing this on a 1.4GHz AMD desktop (512MB RAM)
1st drive IS THE BOOT drive on ide channel 1
2nd drive is the target drv on ide channel 2

1.) boot machine into single user (and / mounted as
RO)
catch the spinning proppeler when booting (I
believe it's called 3rd stage loader?) by typing any
character, then `set hw.ata.wc=1` and then `boot -s`.
Now in single user mode.

2.) `dd if=/dev/ad0 of=/dev/ad2 bs=2048k`
tried diffrent buffers of 1024k, then 4096k. This
buffer of 2MB worked fastest in this configuration.
<ctrl-t> during dd yields progress.

note: due to a lack of proper ATA100 cables that have
2 connectors each, ended up using just the 2 drives
each run, so that's why mounting ad0 as boot(RO) AND
source drive and then ad2 as target on 2nd ide
channel.
SO I'm doing this 20 times for the 20 drives.

note: couldn't get `buffer` command (after installing
port) to behave correctly so ended up not using it,
maybe I didn't put enough time into it but this
procedure does end up being very efficient even
without `buffer` ...

--- Kevin Oberman <obe...@es.net> wrote:
> > Date: Fri, 28 Sep 2001 15:53:45 -0700 (PDT)
> > From: kjerste soderberg <kjer...@yahoo.com>
> >
> > Thank U for this valuable advice
> > can I ask;
> >
> > --- Kevin Oberman <obe...@es.net> wrote:
> > > As others have pointed out, ......I would
> strongly >
> > recommend setting hw.ata.wc=1 during the boot.
> >
> > do I set this in /boot/loader.rc or can I somehow
> set
> > it on the command line much like booting into
> single
> > user (ie: boot -s) at the kernel prompt?
>
> I'm told that you can use the command:
> set hw.ata.wc=1
> at the boot prompt, but I don't know if it needs to
> be done at the
> first boot prompt (from loader) or at the later
> prompt where you do
> boot -s.
>
> You can add the line:
> hw.ata.wc="1" # Turn on write-cache on ATA disks
> to /boot/loader.conf. This is probably not that bad
> an idea. There has
> been endless discussion of the safety of running
> with write cache
> enabled on ATA disks. Most all the gurus run with it
> enabled and Matt Dillon
> (who wrote the FreeBSD VM system and lots of other
> stuff) reports that
> there has never been a documented case of major data
> loss due to disk
> caching. He turns it on. There is a REAL chance of
> minor loss in the
> event of power failure as the data written to cache
> but not dumped to
> the disk will be lost.
>
> Or, just upgrade to 4.4 and it will be on by
> default.
>
> > > I assume you are doing the clone with the system
> > > booted stand-alone and filesystems unmounted
> >
> > yes, I was advised by many here to make certain
> the
> > drives (both source& target) are unmounted..
> >
> > > Don't expect any sign of disk activity except
> the
> > > LED.
> >
> > ANother respondent advised me to do ctrl-T which
> does
> > give me a progress rept and I was also advised to
> do a
>
> This shell dependent, but, if your shell supports
> it, go for it!
>
> > `systat -vmstat 1` for progress but I can't do
> this as
> > I am in single user mode ..
> >
> > Thanx for your advise as well, truly appreciated..
>
> FWIW, here is my laptop clone script. It clones two
> slices, one
> containing Windows and one containing FreeBSD. Takes
> 14 minutes to
> clone 6 GB of data. I clone a 4 GB and a 2 GB slice
> on a 12 GB drive
> to identically sized slices on a 6 GB drive. Drives
> are UDMA33 on
> separate controllers.
>
> #!/sbin/sh
> dd bs=32k if=/dev/ad0s1 of=/dev/ad2s1
> dd bs=32k if=/dev/ad0s2 of=/dev/ad2s2


>
> R. Kevin Oberman, Network Engineer
> Energy Sciences Network (ESnet)
> Ernest O. Lawrence Berkeley National Laboratory
> (Berkeley Lab)
> E-mail: obe...@es.net Phone: +1 510 486-8634

__________________________________________________
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com

To Unsubscribe: send mail to majo...@FreeBSD.org

Daniel O'Connor

unread,
Sep 28, 2001, 10:43:52 PM9/28/01
to

On 28-Sep-2001 kjerste soderberg wrote:
> From what I'm getting from all your instructions
> here's what I'll be doing for these laptops.
>
> Mounting drives in another machine
> source=/dev/ad1
> target=/dev/ad2
> target=/dev/ad3
> (I'll be mounting 2 targets at a time until all 20 or
> so drives are finished)

I assume by mounting you don't mean 'mount /dev/adX /blah'...

> Install the buffer port, then as root do;
> buffer -s 32k -S 1m </dev/ad1 >/dev/ad2
>
> (for target ad2 and would I chg the 32k to 1024k for a
> 1meg buffer?)
> then;
>
> dd if=/dev/ad1 of=/dev/ad2 bs=1024k

I don't know what the buffer port does, but I suspect it does something similar
to dd.. You don't need to do both.

---
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum

To Unsubscribe: send mail to majo...@FreeBSD.org

0 new messages