How to use dd and ddrescue to back up your data
The used data from the NTFS partition /dev/sda1 is saved into the file ‘backup.img’, in this example into the current directory. Restoring the image is achieved by changing ‘--save-image’ to ‘--restore-image’ and using the ‘--overwrite’ option to supply the destination partition. This option is required because ntfsclone is effectively ‘overwriting’ an existing file, an existing partition. The ntfsclone utility is part of the ‘ntfsprogs’ package, which can be installed in Ubuntu in the usual way.
It is important to note that both ntfsclone and partimage write their output images to files, not other partitions. This is because the image format is not a direct copy of the original, just one that can be converted back to that at a later point. With ddrescue you can copy the data directly onto another partition, although it is usually more sensible to copy it to a file; most of us have lots of spare space available on our filesystem, far fewer will have multiple unused partitions the exact size required for backups.
Loopback
At first sight, one significant benefit of duplicating a partition directly to
another partition is that you can easily access the data in the copy. If you
would like to copy some files from your backup, rather than restore the full
image, it is easy to mount the backup partition and do so. Linux offers a
similar feature for backup image files, however, called the loopback device.
When you mount a partition with a command such as ‘mount /dev/sda1 /mnt/data’, you are telling the operating system to use its drivers to access the data stored in the ‘sda1’ partition, and lay this out, ready to use, across the filesystem at the directory point /mnt/data. This mounting process is universal across Unix systems. The loopback device lets you mount a regular file instead, so rather than a device external to the filesystem being mounted and therefore included into the filesystem, the loopback device mounts a file that is already part of the filesystem, laying it out elsewhere. The simplest way to do this is with an extra option in the mount command. Here’s an example:
# mount -o loop /tmp/backup.img /stuff/backup
The format of the command is almost the same as usual. The loop option tells the system that you are not mounting a device, but a normal file. Hereafter the process is the same as ever. The kernel treats the data in the file ‘backup.img’ as if it were a normal storage device, meaning you can access, create and change files. This powerful feature therefore allows you to have the same access to an image file as you would if it were a normal mounted partition. If you want to test this out, without using a real backup image, you can create a simple filesystem. In this example, first we are using the dd command as follows:
# dd if=/dev/zero of=stuff.img bs=1M count=100
This copies 100MB from the special device /dev/zero to the file stuff.img, created in the current directory. The zero device is an infinite supply of zeros, so a 100MB file consisting of zeros is created; this is a standard way to create arbitrary empty files. Next the mke2fs command is run on this file in order to create a filesystem. It warns you that the file you have provided is not a block device. This command now lays out an ext3 filesystem across our blank file, making it an image ready for use. Finally, the new filesystem image is mounted on /stuff using the loopback device. You could now copy files into /stuff, which would in turn be written into the /tmp/stuff.img image file.
In summary, the dd/ddrescue command is the most flexible of all. It can back up any partition, even if the operating system doesn’t support the filesystem used on it. Image files created by the command can be mounted using the loopback device, or the entire image can be written back in place to restore it to its original state. Partimage and ntfsclone are incredibly useful for backing up filesystems with large amounts of free space, as only used parts of the filesystem are copied. The special formats produced cannot be mounted, or copied directly back, they must instead be restored using the same tool that created them. Both methods have their clear advantages, so use whichever better suits the circumstances you have.
Nvidia driver fix for Ubuntu 8.10 users
There is a problem in Ubuntu 8.10 with the proprietary drivers from Nvidia.
Unusual image corruption occurs with window borders when using the 3D desktop
effects on certain graphics cards. Nvidia has since released a set of new
drivers (the 180 series) which fix this problem, and these are available from
Ubuntu 8.10’s repositories. At the time of writing it was not possible to
install these through the ‘Hardware Drivers’ interface (see screen), you should
instead manually install them with ‘sudo apt-get install nvidia-glx-180’. If you
would like to update the drivers, first check the Hardware Drivers interface
before manually installing them.
Related articles
St Helena, a 'small British village' in the mid-Atlantic, is seeking support and funding for a broadband connection
|
|
|
|
|
Computeractive Excel (2010) Online tutorialPrice: £19.99 |
Computeractive Word (2010) Online TutorialPrice: £19.99 |
Computeractive Powerpoint (2010) Online TutorialPrice: £19.99 |
Angry BirdsPrice: £9.99 |
Back Issue CD-Rom 14 (2011)Price: £15.99 |