Operating System - HP-UX
1849382 Members
5573 Online
104044 Solutions
New Discussion

dd if=/dev/rdsk/c1t2d0 of=/dev/rdsk/c2t2d0 bs=2048k

 
SOLVED
Go to solution
Joe Profaizer
Super Advisor

dd if=/dev/rdsk/c1t2d0 of=/dev/rdsk/c2t2d0 bs=2048k

I'm dd'ing my system disk to another disk (both same size) and moving the target drive to another system to boot from. I've done this with 100% success, but most of the time had to run fsck after booting the target system into single-user mode. When I dd'd the source system was at run-level 3. Is it safter to "dd" in single user mode? Or does it matter since it's a raw copy?

Thanks,

..Joe
6 REPLIES 6
Pete Randall
Outstanding Contributor
Solution

Re: dd if=/dev/rdsk/c1t2d0 of=/dev/rdsk/c2t2d0 bs=2048k

Joe,

I would think it would be far safer to do this in single user mode in order to minimize the chances of changes to the file system during the copy.


Pete

Pete
James R. Ferguson
Acclaimed Contributor

Re: dd if=/dev/rdsk/c1t2d0 of=/dev/rdsk/c2t2d0 bs=2048k

Hi Joe:

Raw or cooked, the quieter the better. Consider that during any kind of copy operation you don't want a structures contents changing as it is being copied. Consider too, that you want consistency *between* entities, including data and its metadata. The more quiet, the better.

Regards!

...JRF...
Helen French
Honored Contributor

Re: dd if=/dev/rdsk/c1t2d0 of=/dev/rdsk/c2t2d0 bs=2048k

I would suggest you to do this at single user mode. It will be safe and can avoid user interaction during the dd (like a file change). Even if not asked, I would do an fsck on the first time inorder to avoid any file system errors in future.
Life is a promise, fulfill it!
John Payne_2
Honored Contributor

Re: dd if=/dev/rdsk/c1t2d0 of=/dev/rdsk/c2t2d0 bs=2048k

Or use Ignite, which was built for this very purpose in mind. (make_recovery or make_sys_image)

Hope it helps

John
Spoon!!!!
Brian Bergstrand
Honored Contributor

Re: dd if=/dev/rdsk/c1t2d0 of=/dev/rdsk/c2t2d0 bs=2048k

The only time it would safe to do this in multiuser would be if the disk was unmounted. Can't do that with the root disk. The problem with mu, is that there could be any number of processes reading or writing to the disk. Reading shouldn't cause problems, but writing will almost definitly screw your copy up, since the new data may not have been flushed until after dd has already copied a sector. Or, if some process creates a new file the new data may be there (and the fs blocks allocated), but you will have a stale superblock since that will be in the first sector that is copied.

IOW, always dd your root disk in single user and only dd other disks in mu if you unmount them first. And I'd still run fsck on the copy just to be safe.

HTH.
Dietmar Konermann
Honored Contributor

Re: dd if=/dev/rdsk/c1t2d0 of=/dev/rdsk/c2t2d0 bs=2048k

Joe,

as long as you're copying mounted lvols there is always some kind of risk. Single User Mode with only / mounted is really a good idea... but still requires fsck.

You could boot the system from an install medium or an ignite server and exit to shell. Copying from her would be 100% save (after loading dd along with dld.sl and libc.2).

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)