My purpose:
- Setup a USB stick to boot my FreeNAS (default)
- In the same USB stick, setup HirenBootCD so that I can troubleshoot (esp. in NTFS dics) should things went wrong
Note: most of steps below are performed in VirtualBox 3.1.4 run in my MBP
Steps:
1. Setup VirtualBox (if not already installed)
-> Create a new VM with 128MB, no HDD, and boot from CD
-> Set the USB filter to allow the USB stick to plug into the VM by default
2. Setup HirenBootCD on the usb stick: http://www.hiren.info/pages/bootcd-on-usb-disk
-> Get HirenBootCD.10.2 iso file
-> Mount the iso file to the VM and boot it, go to mini winXP mode
-> Format the USB stick (mine is 2GB)
-> Install Grub4Dos
-> Copy HBCD content and other files to USB
(-> Note that the Grub menu can be modified at this point to prevent the complicated mount command)
-> Shutdown the VM
3. Modify the USB partition and spare space for FreeNAS
-> Get FreeNAS iso file from sourceforge.net
-> Mount FreeNAS iso to the VM and boot it
-> When the boot process done, choose 6 to enter the shell
-> Get the current USB partition table: # fdisk -p /dev/da0 > fdisk.conf
Should note that the USB stick is now having only 1 partition
-> Modify fdisk.conf to prepare the partition table: # nano fdisk.conf
-> fdisk.conf content could be:
# /dev/da0
# geometry of the usb disk
g c245 h255 s63
# resize first partition (0x0c: FAT32) to 2056257 sectors (~1000MB)
p 1 0x0c 63 2056257
# set partition 1 active
a 1
# create second primary partition (0xa5: freebsd) start at 2056383 (beginning of cylinder) and size is 144522 sectors (~70MB)
p 2 0xa5 2056383 144522
-> Test this partition arrangement on the usb stick: # fdisk -f fdisk.conf -itv /dev/da0
-> Apply this partition arrangement to the usb stick: # fdisk -f fdisk.conf /dev/da0
-> Write FreeNAS embedded image to the partition just created: # gunzip -c /cf/FreeNAS-i386-embedded.gz | sudo dd of=/dev/da0s2 bs=512
-> the command above take a very long time to finish (about 30 mins for my case)
4. Mofify the default grub menu come with HirenBootCD
-> Mount the first partition of USB stick: # mount -t msdosfs /dev/da0s1 /mnt/test (remember to create folder /mnt/test first)
-> modify menu.lst: # nano /mnt/test/menu.lst
-> add this session anywhere you lile:
title FreeNAS 7.1.5024
root (hd0,1)
chainloader +1
Bravo, we are done! you now can test it





Hi
Thanks for such a detailed guide, but Im having a bit of trouble. Once I get to the bit where I should install the embedded image onto the partition, I cant find the image under /cf.
I then tried putting the image in using dd on my macbook. But grub is unable to boot into it. The error I get is Error 17: Cannot mount selected partition
Comment by Vishnu Iyengar — 14/11/2010 @ 3:12 am |