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

All fields must be completed. Your email address will not be displayed or used to send marketing messages.

All messages will be checked by moderators before appearing on the site.

See our Privacy Policy for more information.

Related articles

memonic-notetaking-software

Record and organise notes with Memonic Desktop

A handy program for keeping notes

Worry-free Wifi illustration

How to make the most of your Wifi

Get rid of all your Wifi problems with our guide to wireless networking

Edit Windows' right-click menus

How to add to and customise the right-click menus in Windows

If you right-click your mouse, a menu of extra options pops up. If you want to add extra choices to this, then Filerfrog makes it easy to customise your Windows list

Question & Answer

Q.Why can't my browser find the website address I typed...

> Read the answer

Q.All updates have been downloaded, so why won't Windows...

> Read the answer

Q.How do I stop Windows 7 search?

> Read the answer

Best deals on the web

img

Apple iMac 21.5" (MC309)

£929.00- Buy it now

img

Dell Inspiron 620 ST Intel Core i3-2100 3.10GHz / 3GB / 500GB / DVDRW / Win 7 Home Premium

£299.00- Buy it now

img

Apple iMac 27" (MC813)

£1353.99- Buy it now

Great benefits for subscribers!

Poll

Which is your preferred web browser

Jargon Buster

Computing terms explained in plain English

Restore point

A Windows backup of system files and settings.

Great shopping deals from Computeractive