[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] For help, about kernel NBD driver



Please don't reply off-list for on-list questions. Cc to nbd-general
added back.

On Mon, May 31, 2010 at 02:13:17PM +0800, edelweiss_zf3842 wrote:
> Well, what I'm going to do is very simple.
> The operating system, such as Windows XP, may crash any time.
> That's why the restore technic comes out. Now I just want to get
> my previous backup files from remote server, not USB Disk or
> some other kind of Movable Hard Disk, and save them directly on
> local disk so that I can boot Windows XP as before. In order to
> smooth the process, we can first boot it as a Virtual Machine and
> transmit data (backup files) at the same time.
> 
> Just a naive idea :)
> But I don't know whether NBD can help me...

I think the best way to do that is to set up a RAID-like system using
two NBD connections; one would go to the local host, the other would go
to the remote host.

Problem is, you can't use the in-kernel RAID subsystem, since that
requires a specific partitioning layout that is incompatible with
Windows. So you'd have to use something else.

I'm thinking a set-up like the following would work:

/---------------------------------------\   /---------------------\
| Linux host                            |   | Image server        |
|---------------------------------------|   |---------------------|
| < Windows VM >                        |   |                     |
|        |                              |   |                     |
|   [NBD device] -- < your software >---+---+--< windows image >  |
|                          |            |   |                     |
|                   [ local hard disk ] |   |                     |
\---------------------------------------/   \---------------------/

So that when you boot the system, your software starts copying from the
windows image on the image server to the local hard disk. When the
Windows VM writes to the NBD device, your software writes that block to
the local hard disk and "remembers" that the block has been changed (so
that it doesn't overwrite it later on with data from the windows image).
When the Windows VM wants to read, your software first checks whether
the block it wants to read already exists on the local hard disk, and if
not, reads it from the image.

Eventually, all blocks will have been read from the image, and your
software becomes just a redundant layer between the NBD device and the
hard disk. Once that happens, the system can be rebooted and nothing
special needs to happen anymore.

This would require your software to implement the server side of NBD. It
could be implemented entirely in userspace, no need for kernel hackery.

-- 
The biometric identification system at the gates of the CIA headquarters
works because there's a guard with a large gun making sure no one is
trying to fool the system.
  http://www.schneier.com/blog/archives/2009/01/biometrics.html



Reply to: