This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is a disk image created within dd "safe"?

On 09/02/2015 03:57 PM, Clint Olsen wrote:

> I'm also interested in generating images to preserve the entire disk.
> What I'm wondering is whether doing this on a live system through
> Cygwin would produce a safe, bootable disk image or if the the APIs
> that Cygwin has to use or having the disk mounted would make this
> unreliable?

The answer is the same on non-cygwin systems.  ANY attempt to
sequentially read a disk while some other entity may be actively
modifying the same disk is doomed to capture incomplete (and probably
unusable) state.

> A friend speculated that dd might complain about open files or
> some-such thing. I went and tried it on /dev/sda and it seemed to work
> without complaining.

dd won't complain, but it also won't capture an accurate image.  There
is a difference between the block layer (read each sector of the disk,
regardless of what is happening in other sectors due to file system
activity) and the file system layer (read multiple files one at a time,
regardless of which sectors the file system currently maps those files
to).  The only safe way to use dd to clone a disk is if the disk is not
currently mounted by any filesystem that might be actively modifying
sectors in the block device.

There are various solutions that CAN capture an accurate point-in-time
disk snapshot.  For example, on Linux, you can use LVM and create an LVM
snapshot, which separates all data at a given point in time from all
further changes to the live disk, so that you can then do a background
task that reads the snapshot without worrying about data going
inconsistent, and so that the guest can continue to run with the live
overlay.  Many SAN storage vendors sell specific solutions along these
lines, and it is also a hot topic with virtual machine solutions.  But
in every case, these sorts of solutions require additional storage
hierarchies (they are not copying /dev/sda directly, so much as exposing
/dev/sda as a layer on top of other storage such that the actual
snapshot operation utilizes that other storage for the background
copy-on-write overlay magic).

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]