How to write the embedded FreeNAS 8 image under Windows

Status
Not open for further replies.

leadacid

Cadet
Joined
Jun 7, 2011
Messages
5
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

  1. Log into the Windows PC as an administrator.
  2. 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.
  3. Create a temporary folder on the PC to hold the downloads. For example, C:\FreeNAS.
  4. Download the necessary components; the FreeNAS 8 image, physdiskwrite, and the 7-Zip application.
  5. Install 7-Zip by double-clicking the 7z920.exe installer and use the default install options. Delete the installer file from the temp folder.
  6. 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.
  7. 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.
  8. Delete the .xz file from the temp folder.
  9. 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”.
  10. 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.
  11. Change directories to your temporary folder and execute this command:
    Code:
    physdiskwrite.exe –u FreeNAS
    
    Note: The “-u” indicates an override to write to devices larger than 2gb.

    Code:
    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 <mk@neon1.net>
    
    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)
    
    

  12. 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:
    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)

  13. 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:
    186621952/1000000000 bytes written

  14. 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:
    1000000000/1000000000 bytes written in total
    
    C:\FreeNAS>exit

  15. Insert the flash drive into the new FreeNAS server and provided it will boot from USB devices, you should be good to go.
 

Tekkie

Patron
Joined
May 31, 2011
Messages
353
Alternative Windows process

Another route albeit a little more complex perhaps is: :cool:

1) Download the FreeBSD life file system ISO image and burn that on to a CD.
2) Copy the compressed FreeNAS8 image to the root of a partition on your harddrive.
3) Boot the FreeBSD life file system.
4) Mount the partition to which the FreeNAS8 image was copied (in step 2), it will become visible under /mnt/...
5) Execute "xzcat FreeNAS-8.0-RELEASE-i386.Full_Install.xz | dd of=/dev/da0 bs=4k" from /mnt/... NOTE: Take care with the "of=" part of the dd command as it will nuke any data on the device and this can't be undone. :eek:
 

jfr2006

Contributor
Joined
May 27, 2011
Messages
174
Hi:

I tried this on a 8Gb USB stick, but got the following error message:

1048576/1000000000 bytes writtenWrite error after 1048576 bytes.

Is this normal? Also the disk ends up with the normal 466MB partitions...I was hoping it could use the all disk...

Regards.
 

Tekkie

Patron
Joined
May 31, 2011
Messages
353

jfr2006

Contributor
Joined
May 27, 2011
Messages
174
I follow leadacid steps... Yes, i have read about that more than once.. Still does not explain why it should be limited to 1GB. This way there is no free space to add packages :mad:...

I will keep using my compiled version, done to a 2GB USB stick.
 
B

Ben Kussmann

Guest
Make sure nothing in windows is accessing your destination drive. Autorun boned me on this until I figured this out.

Hi:

I tried this on a 8Gb USB stick, but got the following error message:



Is this normal? Also the disk ends up with the normal 466MB partitions...I was hoping it could use the all disk...

Regards.
 

bladestrike

Cadet
Joined
May 29, 2011
Messages
4
Writing FreeNAS 8 to USB stick under Windows

If I could elaborate a bit (the run as Administrator thing needs to be more explicit).

First make sure the USB stick is physically big enough. You should use at least 2GB, preferably 4GB, because the USB drive should be capable of holding at least two images, the current image and a second image wen the occasion comes to upgrade your version of FreeNAS.

Second extract your full install image to a simply named directory, something like "Install" (only seven characters long), on a disk of your choice in your system. Give the extracted image a simple name such as "freenas8" (only 8 characters long). The simple names make it easier to navigate to the working directories while running from the command line.

Third download physdiskwrite from m0n0wall. Extract and install physdiskwrite in the Install directory.

Make sure you invoke the command prompt as an Administrator (right click on the command prompt icon and select "run as Administrator"). Failure to do this will result in physdiskwrite not finding your target drive, with you potentially wiping out your main disk drive.

Fourth navigate to the directory containing both physdiskwrite and freenas8.

Fifth follow the instructions for using diskpart on the m0n0wall page (referenced above). This will ensure the USB stick is emptied and with no partitions.

Sixth run physdiskwrite -u freenas8 and follow the prompts to enter the physical disk number (which you will discover when you run diskpart).

In my case the end result was:
Which disk do you want to write? <0..2> 2
WARNING: that disk is larger than 2GB! 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) y
1000000000/1000000000 bytes written in total


Seventh eject the USB drive, then remove it from your PC and install it into your target system, boot from the USB drive and start the installation and configuration work.
 

leadacid

Cadet
Joined
Jun 7, 2011
Messages
5
Thanks for the tips and clarifications bladestrike! I have incorporated them into the next version of my how-to.
 
R

RoySv

Guest
Hi,

I just used Win32 Image Writer after I unpacked the embbeded file and renamed it to .img

In Win32 image writer you select your img file and then you select the drive to install the img file too.
 

ccnet

Cadet
Joined
Jul 19, 2011
Messages
2
Hi,

after booting on usb key displaying :

FreeBSD/x86 bootstap loader ... Revision 1.1

Then :

Can't load kernel

The ls command failed with "open '/' failed : input/output error"

USB Key is 4 Go and no error writing the image file with physdiskwrite.
Tring another key may don't solve the problem

Thank in advance.
 

hies1971

Cadet
Joined
Jul 23, 2011
Messages
5
Overwrite error physdiskwrite

Hi, there.

I've just followed the tutorial. Unfortunate I get a "overwrite error" :mad: with physdiskwrite.
I'm using a 4gb sandisk usb thumbdrive. Anyone else with this same issue?
Appreciate the input.

Regards Hies
 

najames

Cadet
Joined
Jul 31, 2011
Messages
1
Thanks

Hi,

I just used Win32 Image Writer after I unpacked the embbeded file and renamed it to .img

In Win32 image writer you select your img file and then you select the drive to install the img file too.

I tried using the physdiskwrite without success, it started briefly, then errored/stopped. This method worked great, the USB stick inserted in the server, powered up, and I connected right up.
 

hies1971

Cadet
Joined
Jul 23, 2011
Messages
5
I tried using the physdiskwrite without success, it started briefly, then errored/stopped. This method worked great, the USB stick inserted in the server, powered up, and I connected right up.

thank's a lot. I'll try it...
 

tmstone835

Cadet
Joined
Aug 8, 2011
Messages
5
I noticed that physdiskwrite will not overwrite a USB Flash drive if there are any partitions on that device. I had to remove the default FAT volume and the partition before it would work using DISKPART. It took about 15 minutes to create the Freenas image on a 2GB USB stick.
 
S

shackrock

Guest
FYI, in windows 7, you MUST delete all partitions before trying to use physdiskwrite, as indicated on the first page of the thread. That's the only way I could get it to work.
 

alesga

Cadet
Joined
Sep 13, 2011
Messages
1
It doesn't work properly

When i execute the command for installing in the USB flash Drive, the aplication responds "Failed to open ûu - exiting." Is there anybody that can help me? Thanks

The hole command window shows:
C:\FreeNAS>physdiskwrite.exe -u FreeNAS

physdiskwrite v0.5.2 by Manuel Kasper <mk@neon1.net>

Searching for physical drives...

Information for \\.\PhysicalDrive0:
Windows: cyl: 30401
tpc: 255
spt: 63
C/H/S: 16383/16/63
Model: ST3250310AS
Serial number: 6RY2SKGJ
Firmware rev.: 3.AAC

Information for \\.\PhysicalDrive1:
Windows: cyl: 244
tpc: 255
spt: 63

Which disk do you want to write? (0..1) 1
About to overwrite the contents of disk 1 with new data. Proceed? (y/n) y
Failed to open ûu - exiting.
 
Status
Not open for further replies.
Top