Simple clear advice in plain English

Hands on: Brush up your image

Linux can treat an image file – an exact copy of your disk data – as a device itself

A partition on a hard drive holds a filesystem, which is an ordered and structured layout on the disk for files and directories to be stored on.

Linux – or any other operating system – must be able to understand how this layout works to read and write to it, and thus access the files in any way, and it does this using a filesystem driver.

The raw data on the disk, however, needs no such understanding. The operating system needs only to be able to read and write to the disk itself which, in an operating system such as Linux, is handled completely separately from the filesystem drivers.

A raw image of a drive or partition can be created using the dd or ddrescue commands. These read every byte on the drive and duplicate it exactly. The resulting file is known as an image, since it reflects the exact contents of the original.

Any filesystem can be duplicated in this way, so long as Linux can read each byte from the source successfully.

Loop filesystems
When you mount a block device (such as a partition), you make it accessible for reading and writing. A typical mount command is something such as:

# mount /dev/hda1 /var/myfiles

Here the filesystem stored on the hda1 partition is laid onto the root filesystem in the /var/myfiles directory. This is standard across all forms of Unix and you have no doubt seen or used the command before.

However, what difference is there between a device file such as /dev/hda1 and an image file created by duplicating the data on that device? Each contains the same data, laid out in exactly the same way.

It would be useful if Linux could treat the image file like a device and mount it as such. And it can.

As above, the driver that handles the filesystem (such as ext3 or Fat) is entirely separate from the driver that handles the disk drive (such as IDE or Sata); one is effectively layered on top of the other.

This means that the only practical difference between mounting an image file and mounting a device is at the lowest level: the filesystem driver is the same.

Reader Comments

   

Add your comment

Please keep comments constructive and free from abuse of any kind and swearing. If you wish to link to a product or service online, please do so in such a way that makes it clear that it is not spam. If you are connected to any such product you should make that clear.

We may use your comments in the magazine. We may edit your comments for clarity or to remove unacceptable material. We will attribute your comments but not share your email address.

We request your email address and record your Internet Address (IP address) in order to block spam from our site. We will never share this information without your permission.

All comments are reviewed by the Computeractive Team before being published. Please bear with the slight delay this causes, you don't need to post more than once.

Click here to read our Privacy Policy

Click here to read our site Terms & Conditions

Related articles

Stop others from opening private files

Prevent others from opening private files with Cloudfogger

Protect your sensitive files from prying eyes by encrypting them with free software

Ubuntu installation screen

Learn how to run different operating systems on one PC

There are many Windows alternatives – you can use more than one different system on a single computer easily and safely

adding-ram-to-a-motherboard

Build a PC shopping list

We reveal our suggestions for components to build three different computers

Content Recommendation

Question & Answer

Q.Why is Windows Backup skipping files?

> Read the answer

Q.Why do my scanned documents display gibberish?

> Read the answer

Q.How can I convert MTS files to edit in Windows Movie...

> Read the answer

Best deals on the web

img

Samsung NP350E7C-A04UK

£349.99- Buy it now

img

Toshiba Satellite C850D-11Q (PSCC2E-00R00JEN)

£279.97- Buy it now

img

Lenovo G580 (MAANJUK)

£379.99- Buy it now

Updating your subscription status Loading

Most popular articles

No matching document

Poll

Do you have Windows 8?

Jargon Buster

Computing terms explained in plain English

Restore Point

A Windows backup of system files and settings.

Great shopping deals from Computeractive

Information currently unavailable