Selasa, 31 Juli 2012

HOWTO: Create and use .IMG files from the CLI

Now that Bodhi's second stable release for the desktop is settling down, I am going to be putting a bit of focus on our ARM releases for the next couple of weeks. ARM images typically are provided in the form of .IMG files. Using a downloaded .IMG file is fairly simple. You can write it to a drive of your choice with a single command:

sudo dd if=myfile.img of=/path/to/drive bs=1M

One thing worth noting though is that /path/to/drive should not include any partition number. An example path would be something like:

/dev/sdb

Note that writing large images can take a good deal of time depending on the speed of your drive and that this command will not give you any feedback until it finishes.

Now, perhaps you are like myself and have some interest in creating/distributing .IMG files of your own. Creating image files is also fairly easily and uses the same dd command. An example of how to create an image file is:

sudo dd if=/path/to/drive of=image.img

Note that this command copies the entire contents of the drive - meaning if your drive is large your .IMG file will be equally large! Now, what do you do if you only want to copy part of your drive? Simply add one argument to the above command of course! For example to only copy the first two gigs of data on a drive to a .IMG file use:

sudo dd if=/path/to/drive of=image.img bs=2048 count=1M

I am by no means an expert at using dd, but if you run into any issues feel free to drop a comment below and I'll do my best to help you out.

Cheers,
~Jeff Hoogland

Tidak ada komentar:

Posting Komentar