Work Instruction Title: Writing FreeNAS 8 Embedded Image under Windows Responsible Party: End User Frequency of Work: As needed Version: 2.0.20110615 Written by: leadacid Overview FreeNAS 7 provided an embedded .img file which the end user was able to write a device under Windows using the physdiskwrite software. With the introduction of FreeNAS 8, the developers have moved away from the uncompressed .img embedded image to the compressed .xz image. This new image file type does not have a direct way to write under Windows. This work instruction was developed under Microsoft Windows XP SP3 and used a USB flash drive for the destination media. This work instruction has not been tested with newer versions of Windows, nor other destination devices. Required Items Microsoft Windows PC The PC must have at least 2 GB of free disk space. The end user must have administrator rights on the PC. The PC must have 7-Zip (or comparable) installed. For this document we will be using Microsoft Windows XP SP3. Destination media device The destination media device can be any device that presents itself to Windows as a disk drive. USB flash devices are the most common, but Compact Flash, Secure Digital (SD), IDE, SATA, or other devices are also compatible. The destination media must be at least 2 GB in size. The end user must be able to read and write to the device. For this document we will be using a SanDisk Cruzer Blade 4GB USB drive. FreeNAS 8 embedded image The FreeNAS 8 embedded image is available from the FreeNAS download page. http://sourceforge.net/projects/freenas/files/FreeNAS-8/ Download the file named “FreeNAS-8.0-RELEASE-i386.Full_Install.xz”. It is important to get the “Full Install” and the file with the .xz extension. Select the appropriate image for your destination architecture, either i386 or amd64. Unless you have a strong reason not to, download the newest release version. For this document we will be using the version 8.0 release for amd64. Physdiskwrite.exe Download a copy of physdiskwrite.exe from the m0n0wall project’s website. http://m0n0.ch/wall/physdiskwrite.php This is used to write the image to your destination media device. For this document we will be using physdiskwrite version 0.5.2. 7-Zip Download and install a copy of 7-Zip http://www.7-zip.org/download.html This is used to extract the image file from the FreeNAS 8 .xz file. For this document we will be using 7-Zip version 9.20. Lessons Learned There are many compelling reasons to do this under Windows. Work is upset enough with me that I want to run a BSD machine (FreeNAS) and I don't want to spend an hour to set up a Linux PC just to write a single disk image. Cygwin might help. It looks like it may be able to write to a raw device with cygwin’s dd, I just didn't know how. The official way to do this (http://doc.freenas.org/index.php/Installing_from_the_Image) can be done with various forms of live CDs. My destination machine did not have a CDROM drive. Disk space requirements have gone up significantly with version 8. Your destination device requires at least 2GB to write the fully extracted image. The extracted image is 1GB exactly, where most 1GB flash drives format down to 900ish MB. While technically you can install FreeNAS onto a hard drive or other such larger disk, this is not recommended as you will not be able to use the remainder of the drive. In other words, FreeNAS uses the entire drive and will not allow you to store data on it, regardless of the size of the drive. physdiskwrite.exe will still work with the new FreeNAS 8 image, but you have to decompress it first. You need the newest version of 7-Zip (or something comparable) to extract the .xz file. Because of the way FreeNAS 8 handles the boot device, any “extra” capacity will not be available to the end user. For example, since the boot image is only 1GB, using a 4gb drive will “waste” 3GB of space. I personally have never had to partition the destination media before use, but some users have recommended using diskpart to empty the drive before-hand and remove all partitions. m0n0wall has some additional information about this process on the physdiskwrite page here: http://m0n0.ch/wall/physdiskwrite.php. Step by Step Instructions Log into the Windows PC as an administrator. Connect your intended destination device. If it is already formatted for Windows, ensure you can read and write to the device. If it is not formatted for Windows, ensure that it is available as a disk drive. If possible, ensure nothing is attempting to access the drive. Disable AutoRun and the like to prevent Windows from accessing the disk. Create a temporary folder on the PC to hold the downloads. For example, C:\FreeNAS. Download the necessary components; the FreeNAS 8 image, physdiskwrite, and the 7-Zip application. Install 7-Zip by double-clicking the 7z920.exe installer and use the default install options. Delete the installer file from the temp folder. Extract the physdiskwrite-0.5.2.zip file to your temporary folder; this will extract the physdiskwrite.exe file. Delete the zip file from the temp folder. Right click on the FreeNAS-8.0-RELEASE-amd64.Full_Install.xz file, select the 7-Zip menu item, and then click the Extract Here menu item. This will extract the 1GB file to the temporary folder. Delete the .xz file from the temp folder. Rename the extracted FreeNAS-8.0-RELEASE-amd64.Full_Install 1GB image to something simple, like “FreeNAS”. This will make the command prompt work easier later on. You should now just have two files in your temporary folder, “FreeNAS” and “physdiskwrite.exe”. Open a command prompt. Ensure you have administrative rights within this command prompt; for example, by right clicking on the Command Prompt icon and selecting, Run As and then entering an administrator account. Change directories to your temporary folder and execute this command: Code (text): physdiskwrite.exe –u FreeNAS Note: The “-u” indicates an override to write to devices larger than 2gb. Code (text): C:\>cd FreeNAS C:\FreeNAS>dir Volume in drive C is OS Volume Serial Number is C462-2D0F Directory of C:\FreeNAS 06/15/2011 11:48 AM <DIR> . 06/15/2011 11:48 AM <DIR> .. 06/15/2011 11:31 AM 1,000,000,000 FreeNAS 02/16/2009 07:44 PM 90,112 physdiskwrite.exe 2 File(s) 1,000,090,112 bytes 2 Dir(s) 7,282,081,792 bytes free C:\FreeNAS>physdiskwrite.exe -u FreeNAS physdiskwrite v0.5.2 by Manuel Kasper <firstname.lastname@example.org> Searching for physical drives... Information for \\.\PhysicalDrive0: Windows: cyl: 9729 tpc: 255 spt: 63 C/H/S: 16383/16/63 Model: ST380011A Serial number: 5JVTPQ1B Firmware rev.: 8.01 Information for \\.\PhysicalDrive1: Windows: cyl: 9726 tpc: 255 spt: 63 C/H/S: 16383/16/63 Model: Maxtor 6Y080M0 Serial number: Y210Z9KC Firmware rev.: YAR51HW0 Information for \\.\PhysicalDrive2: Windows: cyl: 489 tpc: 255 spt: 63 Which disk do you want to write? (0..2) Select the disk you wish to write the image to. In this example, there are two physical hard disks in the PC at drives 0 and 1 and drive 2 is the flash drive. Enter the appropriate drive number and press enter. Code (text): Which disk do you want to write? (0..2) 2 WARNING: that disk is larger than 2 GB! Make sure you're not accidentally overwriting your primary hard disk! Proceeding on your own risk... About to overwrite the contents of disk 2 with new data. Proceed? (y/n) Press Y to write to the disk. The byte counter will now start counting up until it is finished writing. This tends to take about 5 minutes on a USB 2 connection. Code (text): 186621952/1000000000 bytes written Once physdiskwrite is finished writing to the device, it will display a full count and return to the command prompt. (If the counter does NOT display 1000000000/1000000000, then something went wrong.) Type “exit” to close the command prompt. Safely eject the USB device and then physically remove it from the PC. Code (text): 1000000000/1000000000 bytes written in total C:\FreeNAS>exit Insert the flash drive into the new FreeNAS server and provided it will boot from USB devices, you should be good to go.