View Single Post
  #3   (View Single Post)  
Old 23rd June 2014
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

The TL;DR answer is "yes, but..."

There are two options.

1) You could replicate the drive with dd(1) if the destination device is the same size or larger, and if it has the same sector size. If you use this option, replicate the raw device. Don't copy an open filesystem -- so this is best done from the RAMDISK kernel

example: # dd if=/dev/rsd0c of=/dev/rsd1c bs=1m

2) The more flexible option is to manually configure the destination device. It can be physically smaller, and have a different sector size. For MBR architectures, fdisk(8) is used to create an MBR, and installboot(8) is used for writing the boot blocks.

The example here uses tar(1) for copying, other tools are also usable, such as dump/restore, pax, or cpio. This tar example shown can be used from the RAMDISK kernel.

example (assumes a single "a" partition and an MBR architecture)

# fdisk -iy sd1
# disklabel -E sd1 [configure as you like]
# newfs sd1a
# mkdir in out
# mount /dev/sd0a in
# mount -o async,noatime /dev/sd1a out
# (cd in; tar cf - .) | (cd out; tar xpf -)
# cd in/usr/mdec
# ./installboot -v -r ../out sd1 biosboot boot

Nothing here was tested. Don't blindly copy/paste anything.

Last edited by jggimi; 23rd June 2014 at 01:52 AM. Reason: two typos
Reply With Quote