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: "Device or resource busy" during read (rsync)


On Dec 22 21:55, Mikhail Usenko wrote:
> On Sun, 22 Dec 2013 00:02:10 +0000
> Winkel, Richard J. <...> wrote:
> 
> > I have a hard time believing this is an unusual question but I swear 
> > I've been googling everywhere without an answer!  :)
> > I'm using rsync (under cygwin) to backup windows servers to a linux box 
> > and it's working wonderfully, except that if a file is open rsync can't 
> > access it even for reading.   I know some windows-based backup programs 
> > don't have the problem so I'm hoping there's some way to avoid it in 
> > cygwin.  I've looked at the cygwin mount options but don't see anything 
> > obvious.  Is there a way around it?
> 
> Hello, Richard
> You need to use VSS which stands for 'Volume Shadow copy Service' (or  'Volume Snapshot Service') on Windows. It is based on copy-on-write technology below the NTFS level and is used by Windows to make backups of the running system including of opened and locked files. (Also VSS utilizes a number of 'writers' that helps to make a consistent backup of opened database files for instance.) The shadow copy may be created by using different userspace tools:
> * vshadow.exe (http://msdn.microsoft.com/en-us/library/bb530725(VS.85).aspx)
> * vssadmin.exe (on the server OSes)
> * wmic.exe
> * by calling COM WMI objects from windows script host (http://support.microsoft.com/kb/188135) - VBA or JS scripts or from Windows PowerShell scripts.
> 
> The easiest way to access the created shadow snapshot:
>  http://blogs.msdn.com/b/adioltean/archive/2008/02/28/a-simple-way-to-access-shadow-copies-in-vista.aspx

You can access the shadow copies in Cygwin via /proc/sys:

  $ cd /proc/sys/Device
  $ ls -l HarddiskVolumeShadowCopy*
  lr--r--r-- 1 Administrators SYSTEM      0 Dec 23 10:32 HarddiskVolumeShadowCopy{0f7ef985-69b8-11e3-8264-ccdf67e6642d} -> /proc/sys/Device/HarddiskVolumeShadowCopy2
  brwxrwx--x 1 Administrators SYSTEM 0, 250 Dec 23 10:32 HarddiskVolumeShadowCopy2
  $ cd HarddiskVolumeShadowCopy2/

Note the trailing slash in the last cd command!  It's required due to
the dualism of the HarddiskVolumeShadowCopy2 entry, being a device *and*
the root dir of a drive.  ANyway, after this, you can access the shadow
copy just like your normal drive:

  $ ls
  $Recycle.Bin            hiberfil.sys         swapfile.sys
  bootmgr                 pagefile.sys         Symbols
  BOOTNXT                 PerfLogs             System Volume Information
  Config.Msi              Program Files        Users
  cygwin                  Program Files (x86)  Windows
  cygwin64                ProgramData
  Documents and Settings

> Then rsync can be used to copy files from the shadow snapshot after which the snapshot can be deleted.

Right.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpXZrZ9_uVh8.pgp
Description: PGP signature


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