How to write the embedded FreeNAS 8 image under Windows

Discussion in 'Installation' started by leadacid, Jun 7, 2011.

  1. Offline

    leadacid

    Member Since:
    Jun 7, 2011
    Messages:
    5
    Message Count:
    5
    Likes Received:
    0
    Trophy Points:
    0
    leadacid, Jun 7, 2011

    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 (text):
      1. physdiskwrite.exe –u FreeNAS
      2.  
      Note: The “-u” indicates an override to write to devices larger than 2gb.

      Code (text):
      1.  
      2. C:\>cd FreeNAS
      3.  
      4. C:\FreeNAS>dir
      5.  Volume in drive C is OS
      6.  Volume Serial Number is C462-2D0F
      7.  
      8.  Directory of C:\FreeNAS
      9.  
      10. 06/15/2011  11:48 AM    <DIR>          .
      11. 06/15/2011  11:48 AM    <DIR>          ..
      12. 06/15/2011  11:31 AM     1,000,000,000 FreeNAS
      13. 02/16/2009  07:44 PM            90,112 physdiskwrite.exe
      14.                2 File(s)  1,000,090,112 bytes
      15.                2 Dir(s)   7,282,081,792 bytes free
      16.  
      17. C:\FreeNAS>physdiskwrite.exe -u FreeNAS
      18.  
      19. physdiskwrite v0.5.2 by Manuel Kasper <mk@neon1.net>
      20.  
      21. Searching for physical drives...
      22.  
      23. Information for \\.\PhysicalDrive0:
      24.    Windows:       cyl: 9729
      25.                   tpc: 255
      26.                   spt: 63
      27.    C/H/S:         16383/16/63
      28.    Model:         ST380011A
      29.    Serial number: 5JVTPQ1B
      30.    Firmware rev.: 8.01
      31.  
      32. Information for \\.\PhysicalDrive1:
      33.    Windows:       cyl: 9726
      34.                   tpc: 255
      35.                   spt: 63
      36.    C/H/S:         16383/16/63
      37.    Model:         Maxtor 6Y080M0
      38.    Serial number: Y210Z9KC
      39.    Firmware rev.: YAR51HW0
      40.  
      41. Information for \\.\PhysicalDrive2:
      42.    Windows:       cyl: 489
      43.                   tpc: 255
      44.                   spt: 63
      45.  
      46. Which disk do you want to write? (0..2)
      47.  
      48.  
    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 (text):
      1.  
      2. Which disk do you want to write? (0..2) 2
      3. WARNING: that disk is larger than 2 GB! Make sure you're not accidentally
      4. overwriting your primary hard disk! Proceeding on your own risk...
      5. 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 (text):
      1. 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 (text):
      1.  
      2. 1000000000/1000000000 bytes written in total
      3.  
      4. 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.
  2. Offline

    Tekkie

    Member Since:
    May 31, 2011
    Messages:
    332
    Message Count:
    332
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Software Development &amp; Technology Management,
    Location:
    Santa Monica
    Tekkie, Jun 8, 2011

    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:
  3. Offline

    jfr2006

    Member Since:
    May 27, 2011
    Messages:
    180
    Message Count:
    180
    Likes Received:
    1
    Trophy Points:
    0
    jfr2006, Jun 9, 2011

    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.
  4. Offline

    Tekkie

    Member Since:
    May 31, 2011
    Messages:
    332
    Message Count:
    332
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Software Development &amp; Technology Management,
    Location:
    Santa Monica
    Tekkie, Jun 9, 2011

    Which route did you take for writing the image to the USB stick?

    Partition info RTFM: http://doc.freenas.org/index.php/Hardware_Requirements ;)
  5. Offline

    jfr2006

    Member Since:
    May 27, 2011
    Messages:
    180
    Message Count:
    180
    Likes Received:
    1
    Trophy Points:
    0
    jfr2006, Jun 9, 2011

    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.
  6. Offline

    Ben Kussmann Guest

    Member Since:
    Ben Kussmann, Jun 9, 2011

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

  7. Offline

    bladestrike

    Member Since:
    May 29, 2011
    Messages:
    4
    Message Count:
    4
    Likes Received:
    0
    Trophy Points:
    0
    bladestrike, Jun 10, 2011

    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.
  8. Offline

    bladestrike

    Member Since:
    May 29, 2011
    Messages:
    4
    Message Count:
    4
    Likes Received:
    0
    Trophy Points:
    0
    bladestrike, Jun 10, 2011

    Now if only I could spell "Writing" correctly in the title...
  9. Offline

    leadacid

    Member Since:
    Jun 7, 2011
    Messages:
    5
    Message Count:
    5
    Likes Received:
    0
    Trophy Points:
    0
    leadacid, Jun 15, 2011

    Thanks for the tips and clarifications bladestrike! I have incorporated them into the next version of my how-to.
  10. Offline

    RoySv Guest

    Member Since:
    RoySv, Jul 7, 2011

    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.
  11. Offline

    ccnet

    Member Since:
    Jul 19, 2011
    Messages:
    2
    Message Count:
    2
    Likes Received:
    0
    Trophy Points:
    0
    ccnet, Jul 19, 2011

    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.
  12. Offline

    hies1971

    Member Since:
    Jul 23, 2011
    Messages:
    5
    Message Count:
    5
    Likes Received:
    0
    Trophy Points:
    1
    hies1971, Jul 23, 2011

    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
  13. Offline

    ccnet

    Member Since:
    Jul 19, 2011
    Messages:
    2
    Message Count:
    2
    Likes Received:
    0
    Trophy Points:
    0
    ccnet, Jul 23, 2011

    Have you format the usb device before using physdiskwrite ?
  14. Offline

    hies1971

    Member Since:
    Jul 23, 2011
    Messages:
    5
    Message Count:
    5
    Likes Received:
    0
    Trophy Points:
    1
    hies1971, Jul 23, 2011

    Yes, I've tried fat and fat32. Did also a slow and fast format without any results..
  15. Offline

    ProtoSD FreeNAS Guru

    Member Since:
    Jul 1, 2011
    Messages:
    3,359
    Message Count:
    3,359
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
  16. Offline

    najames

    Member Since:
    Jul 31, 2011
    Messages:
    1
    Message Count:
    1
    Likes Received:
    0
    Trophy Points:
    0
    najames, Jul 31, 2011

    Thanks

    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.
  17. Offline

    hies1971

    Member Since:
    Jul 23, 2011
    Messages:
    5
    Message Count:
    5
    Likes Received:
    0
    Trophy Points:
    1
    hies1971, Jul 31, 2011

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

    tmstone835

    Member Since:
    Aug 8, 2011
    Messages:
    5
    Message Count:
    5
    Likes Received:
    0
    Trophy Points:
    1
    tmstone835, Aug 8, 2011

    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.
  19. Offline

    shackrock Guest

    Member Since:
    shackrock, Aug 13, 2011

    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.
  20. Offline

    alesga

    Member Since:
    Sep 13, 2011
    Messages:
    1
    Message Count:
    1
    Likes Received:
    0
    Trophy Points:
    0
    alesga, Sep 13, 2011

    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.

Share This Page