|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
Cloning an entire drive?
I've had this question for some time, but have never asked...
There is an article from the OpenBSD Journal which covered cloning drives: http://undeadly.org/cgi?action=artic...20080319204706 The author advocates using dump & restore on each partition, but if cloning the entire drive is the goal, why not simply back up the c partition? |
|
|||
Well if by C drive you mean /root partition then no you cant just backup your root partition. Things like usrland apps and /etc configuration files are all items that most people like to back up; at lest generally. Dump/Restore works great on BSD systems. If you are wanting a more universal way to "clone" your hard drive the dd command works wonders. Heres a small example: http://www.linuxweblog.com/dd-image
Last edited by Eam404; 8th July 2008 at 07:57 PM. Reason: Fsck |
|
|||
Quote:
Again, given that /dev/wd0c or /dev/sd0c both covers the entire disk and is accessible, why not clone it instead of each individual partition? |
|
|||
No, for at least two reasons. One, cp(1) copies relative to the user that invoked the command. If cp is invoked as a user other than root, then permissions may be set which will not allow that user to read and copy. If root is used to copy files, then individual user ownership is lost. Two, consider all the device nodes residing in /dev. The script /dev/MAKEDEV is executed at installation time for a reason.
|
|
|||
If the drive being cloned is a boot drive, you should also consider running installboot(8) as the article suggests.
|
|
|||
For one revzalot, /dev/{wd0,wd1} don't exist.. and you can't use "cp" like that either.
To backup a partition, I use either tar or dump, if I'm trying to recover something.. like lost data off a friends thumb drive or w/e, I duplicate the partition with dd... $ dd if=/dev/rsd0i of=partition-image.img Then work on the image instead of risking the drive.. |
|
|||
Quote:
Code:
NAME dump - filesystem backup From one of my systems Code:
$ disklabel wd0 # Inside MBR partition 0: type A6 start 63 size 81915372 # /dev/rwd0c: type: ESDI disk: ESDI/IDE disk label: WDC WD3200AAKS-2 flags: bytes/sector: 512 sectors/track: 63 tracks/cylinder: 255 sectors/cylinder: 16065 cylinders: 38913 total sectors: 625142448 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0 16 partitions: # size offset fstype [fsize bsize cpg] a: 81787372 63 4.2BSD 2048 16384 1 b: 128000 81787435 swap c: 625142448 0 unused 0 0 i: 204796620 163830870 unknown j: 256509855 368627490 MSDOS I have some other OS's installed Code:
]fdisk wd0 Disk: wd0 geometry: 38913/255/63 [625142448 Sectors] Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------ *0: A6 0 1 1 - 5098 254 63 [ 63: 81915372 ] OpenBSD 1: A9 5099 0 1 - 10197 254 63 [ 81915435: 81915435 ] NetBSD 2: A5 10198 0 1 - 22945 254 63 [ 163830870: 204796620 ] FreeBSD 3: 05 22946 0 1 - 38912 254 63 [ 368627490: 256509855 ] Extended DOS dump is not so smart it can backup NetBSD, FreeBSD and the extended DOS partitions in one go
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
What J65nko posted *should* be common knowledge, I'm not even going to comment on Eam404's reply.
|
|
|||
Welp, I guess thats what I get for not reading the whole post...
|
|
|||
I hope there's no problem necroing this thread since it's a sticky.
For the record, cloning an entire disk through the c partition can be done, using dd(1), HOWEVER, this can be dangerous. There's this post from 2001* by Randy Lewis, it basically says: Code:
Example: +----------- bytes/sector value / +------- sectors/cylinder value / / % dd if=/dev/rsd0c of=/dev/rsd1c bs=512x4520 count=7931 <cr> / total cyliders to copy value -----+ First, the obvious, dd is dumb, it shouldn't be run on a mounted/live disk. Incomplete files, inconsistent fs and partitions marked unclean since they were never unmounted are to be expected. Which means the clone will have to be fscked before use. Second, OpenBSD 5.0+ (AFAIK) uses disk UIDs, fstab by default doesn't have /dev/sd0 in it, it has the ID of the disk instead. The clone, since it's an exact copy, will end up having the same DUID as the original, not good if the clone isn't pulled out of the system right away. The ID can be changed using disklabel(8)'s "i" command in the editor. On the other hand, assuming two identical disks, reboot the system from a live cd (single-user works too I guess), run dd, pull out the clone and keep it in storage, and you've got a full system backup ready to go in as long as it takes to change a disk. Didn't actually try this last part yet, but there's no reason it shouldn't work, right? * Can't post links. The post can be found at marc.info /?l=openbsd-tech&m=100765187914137&w=2, or just search for "Re: Cloning OpenBSD disks (amended / expanded explanation)" on google. |
|
|||
Some days ago I wrote a brief article on my personal blog about cloning easily disks (whether they are SATA or SSD). The article is in catalan: http://joancatala.net/node/1419
Basically, I burned an Ubuntu (live) image. I did dd if=MY_DISK of=BACKUP_COPY_IMAGE bs=32M I changed the disk, from SATA3 to SSD. Finally I did if=BACKUP_COPY_IMAGE of=MY_NEW_DISK bs=32M Simple solution. Buy some beers, because is a lot of time (about 4/5 hours). |
|
|||
My 'cloning' program has been dd for quite some time, on both BSDs & Linux distros.
Fairly easy to learn to use, & found on most, if not all, unix like systems, just double check your input & output before committing.
__________________
Linux since 1999, & also a BSD user. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
which drive is what? | knasbas | OpenBSD Installation and Upgrading | 2 | 20th July 2009 09:48 PM |
cannot open cloning pty | l2fl2f | FreeBSD General | 2 | 10th December 2008 07:30 PM |
How can I tell if my USB drive is bad? | JMJ_coder | General Hardware | 4 | 3rd November 2008 04:12 AM |
backing up an entire system | mwotsch | FreeBSD General | 5 | 14th July 2008 03:00 PM |
Cloning FreeBSD | tomcatf14 | FreeBSD Installation and Upgrading | 5 | 10th June 2008 09:26 PM |