Re: [OxLUG] Raw devices

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Peter Grandi
Date:  
To: Oxfordshire Linux User Group Discussion List
Subject: Re: [OxLUG] Raw devices
>> Hi, I'd like to backup entire partition (/dev/sda1) with
>> dd. I don't see any raw devices under /dev, so is the
>> following good way of doing


> I've done it like that many times without problem in the
> past.


That works well. Raw devices are going to disappear as they have
been replaced by 'O_DIRECT' which is supported in newer (several
years) version of 'dd' as for example:

dd bs=1M iflag=direct if=/dev/sda1 oflag=direct of=sda.raw

A largish block size is necessary to get things running fast with
'O_DIRECT'. Sometimes running this as two 'dd' connected by a
pipe helps (overlaps input and output better).

I use something close to the above to backup partitions between
disks (I do disk-disk backups using a SATA/eSATA cradle).

That runs with modern disks at around 120-90MB/s (outer to inner
tracks).

> I'm not sure of the relative merits of 64k block sizes vs
> other sizes, but I generally err on the larger side...


If you are using the block interface the block size does not
matter a lot (unless very small).

>> dd if=/dev/sda1 of=sda1.raw bs=64k


It is somewhat untraditional and risky to specify options in
that order. It is best to assume that UNIX-style commands parse
and ''execute'' arguments strictly left-to-right. 'dd' IIRC does
not, but it is not a good idea to rely on that.

> I often do things like this, which can save a bunch of space
> on the output drive if the disk is new and has lots of blank
> space:


> dd if=/dev/sda1 bs=1024k | gzip -1c > sda1.raw.gz


That's similar to some of my own backups. I use 'lzop' though as
it is a lot faster than 'gzip' (even with '-1'), and I think
that it is more recoverable in case of damage. Parallel 'bzip2'
on modern SMP systems may also look attractive, but 'lzop'
compresses well enough for me.