As part of my FreeNAS 8 build, I purchased a Transcend 2GB USB drive which fits onto a standard motherboard 10-pin USB header to avoid having a USB thumb drive sticking out of the back of the case.
Unfortunately this took a while to arrive as scan.co.uk had to order it in specially, so my initial FreeNAS install was onto a temporary USB thumb drive.
Once the internal USB drive had arrived, I needed to transfer my install onto the new drive. Although it probably would have been possible to use FreeNAS’s backup/restore to move my settings onto a fresh install, I wanted to try a low-level copy from the temporary thumb drive to the internal drive if possible.
The transfer can be made quite easily using dd, however first it is necessary to identify which physical disk maps to which USB device, which is made slightly more difficult by the fact that the drive partitions are labelled with glabel rather than using the underlying drive partition names.
The following procedure worked for me:
- Boot FreeNAS into single-user mode (Select “4. Boot FreeNAS in single user mode at the boot menu”
- Type “mount” to identify which glabel the old USB drive is mounted on – e.g.
$ mount
/dev/ufs/FreeNASs1a on / (ufs, local, read-only, soft-updates) - Run “glabel list | grep <label> -B 2″ (replacing “FreeNASs1a” with the label displayed in the previous step). The “Geom name” provides the underlying drive partition name, in this case da0s1a:
$ glabel list | grep FreeNASs1a -B 2
Geom name: da0s1a
Providers:
1. Name: ufs/FreeNASs1a - Take the first three letters of the partition name from the previous step to get the device name (da0 in the example above).
- Run “grep da. /var/log/messages”:
$ grep da. /var/log/messages
May 25 09:12:55 freenas kernel: da0: Removable Direct Access SCSI-0 device
May 25 09:12:55 freenas kernel: da1: Fixed Direct Access SCSI-0 device - From the output above, one of the device names should match that of the Freenas label, check that the disk type matches that expected. The other should match your new USB stick.
- Triple-check the above as the following command will destroy your FreeNAS disk if run incorrectly!
- Run “dd if=/dev/<old device> of=/dev/<new device> bs=16k” to perform the copy, e.g.
$ dd if=/dev/da0 of=/dev/da1 bs=16k
Update: The ‘camcontrol’ command also allows devices to be listed:
# camcontrol devlist
at scbus1 target 0 lun 0 (pass0,ada0)
at scbus2 target 0 lun 0 (pass1,ada1)
at scbus4 target 0 lun 0 (pass2,ada2)
at scbus7 target 0 lun 0 (pass3,da0)
One Trackback
[…] The Transcend USB drive actually took a little while longer to arrive (as scan.co.uk had to order it in specially), so I initially installed FreeNAS onto a USB thumb drive and later transferred it to the Transcend USB drive with dd. […]