Lars Noodin wrote: > I had a hard drive die and used the chance to move to 4.2. Since the > 'new' machine is of the same vintage as the one it replaced, I expect it > to start grinding to a halt soon, too. > > Is there a way to copy one entire hard drive, partition table and all, > to another -- in one line? > > I tried something like this one but it seems to work only for specific > partitions: > ssh target_address dd if=remotefile | dd of=localfile > > I'd like to just steamroll over the previous partitions. > > Regards, > -Lars
In the general case, I don't think you will succeed with this assuming a "live" file system on the destination machine. Based on experiments on much simpler tasks, you will probably find the OS gets really confused and starts clobbering the newly laid-down FS before it dies a horrible death. My experiments were involving switching between OpenBSD installs on the same disk. I figured it would be pretty easy, simply change the partition types on both partitions, and away we go! Well...as it turned out, the OS got confused between the disklabel that was in memory (the one I booted from) and the one that was on the newly activated partition, and unpleasant things were the result (as was reloading one of the partitions). In general, it seems to be bad to drastically change the disklabel on a running system (i.e., changing the beginning and ending points of a currently mounted partition). HOWEVER, if you can do it from bsd.rd, it should be no problem. The one-line part is just a dangerous stunt, really. Make one error, and it goes bad quickly. Nick.

