Re: [OxLUG] Raw devices

Top Page
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Oskar Pearson
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
> it?
> dd if=/dev/sda1 of=sda1.raw bs=64k

I've done it like that many times without problem in the past. I'm not sure of the relative merits of 64k block sizes vs other sizes, but I generally err on the larger side...

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

This is fine if you want to dump the raw item back using the reverse process with gunzip -c as the input, but it's less useful for things like "mount -oloop". I guess it depends what you are trying to achieve.

I think it should work if you dump it back to a different disk with different track layouts etc, but I'm not 100% convinced it'll boot - grub/lilo may mess up due to different disk layouts. If you re-run grub it'll probably be fine, and you can also extend the filesystem / partition so as to transition your data to a new disk.

As an aside: I say "without problems" except for that one time where I got "if" and "of" the wrong way around in something closer to your command - I was typing on the floor in a terrible position and I just plain messed it up.

Thankfully Siobhan and I still got married.. even though I was trying to make the only backup of the data on that drive at the time. I still get reminded of it from time to time, though. :)