🌑

Linhost.info

Write a .img to a Compact Flash with Physdiskwrite

For this tutorial I am going to write a 2GB pfSense image to a 4GB Compact Flash card using Physdiskwrite a command line utility for Windows. Sometimes the images may be compressed, extract the contents before attempting to write them to a card. It would be wise to place both physdiskwrite.exe and the .img file in the same directory.

Let’s Start…

Open a command prompt in Windows with Administrator rights(necessary) and move to the directory where Physdiskwrite and the image are located.

C:UsersLuisDesktop>cd tools

C:UsersLuisDesktoptools

To find all available disk use the following command.

physdiskwrite.exe -a

physdiskwrite v0.5.2 by Manuel Kasper Searching for physical drives…

Information for .PhysicalDrive0:
Windows: cyl: 77825
tpc: 255
spt: 63
C/H/S: 16383/16/63
Model: WDC WD6401AALS-00J7B1
Serial number: WD-WMATV3658664
Firmware rev.: 05.00K05

Information for .PhysicalDrive1:
Windows: cyl: 60801
tpc: 255
spt: 63
C/H/S: 16383/16/63
Model: WDC WD5001AALS-00L3B2
Serial number: WD-WMASZ0056513
Firmware rev.: 01.03B01

Information for .PhysicalDrive2:
Windows: cyl: 924
tpc: 128
spt: 63
C/H/S: 7395/16/63
Model: ELITE PRO CF CARD 4GB
Serial number: 5B021A040
Firmware rev.: Ver3.05K

Information for .PhysicalDrive3:
Windows: cyl: 30401
tpc: 255
spt: 63

Which disk do you want to write? (0..3) Which disk do you want to write? (0..3)

The output above tells us that PhysicalDrive2 is the name of our 4GB Compact Flash. With that in mind we are going to tell Physdiskwrite to write our image file pfSense-1.2.3-2g-20091207-1914- nanobsd.img to the second drive.

Note: You need to use the -u parameter on cards bigger than 2GB, this is due to a safety precaution.

physdiskwrite.exe -u pfSense-1.2.3-2g-20091207-1914-nanobsd.img

physdiskwrite v0.5.2 by Manuel Kasper Searching for physical drives…

Information for .PhysicalDrive0:
Windows: cyl: 77825
tpc: 255
spt: 63
C/H/S: 16383/16/63
Model: WDC WD6401AALS-00J7B1
Serial number: WD-WMATV3658664
Firmware rev.: 05.00K05

Information for .PhysicalDrive1:
Windows: cyl: 60801
tpc: 255
spt: 63
C/H/S: 16383/16/63
Model: WDC WD5001AALS-00L3B2
Serial number: WD-WMASZ0056513
Firmware rev.: 01.03B01

Information for .PhysicalDrive2:
Windows: cyl: 924
tpc: 128
spt: 63
C/H/S: 7395/16/63
Model: ELITE PRO CF CARD 4GB
Serial number: 5B021A040
Firmware rev.: Ver3.05K

Information for .PhysicalDrive3:
Windows: cyl: 30401
tpc: 255
spt: 63

Specify the number of the disk you wish to write to, in this case the disk is number 2.

Which disk do you want to write? (0..3) 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…

Make this is the disk you want to overwrite, if so type y and press Enter to start.

About to overwrite the contents of disk 2 with new data. Proceed? (y/n) y
2001194496/2001194496 bytes written in total

Depending on the quality of the card and amount of data the process may take from 5 minutes to 10 minutes(may vary).

Conslusion

Compact Flash cards offer some benefits like no movable parts and quiet operation, if you intend to install FreeNAS, pfSense, or any other operating system in a compact flash then this tutorial will be useful.

, , , — May 27, 2010