[libvirt-users] re-create disk image file

Joe Linoff jlinoff at tabula.com
Mon Nov 5 20:25:14 UTC 2012


Hi Henrik:

When I tried to copy the file descriptor file a "Stale NFS file handle"
error was generated:

$ cp -f /proc/13196/fd/9 /tmp/guest.img
cp: cannot stat `/proc/13196/fd/9': Stale NFS file handle

I suppose that makes sense because the file was accidently deleted but
from the NFS server perspective it really isn't there. Do you know of
any way to work around it?

> Or why not just attach a new disk to the guest and copy stuff inside
the guest?

I understand how that would work to recover individual files/directories
but I don't understand how I would be able to recover the entire image.
Can you explain?

Thanks,

Joe

-----Original Message-----
From: libvirt-users-bounces at redhat.com
[mailto:libvirt-users-bounces at redhat.com] On Behalf Of Joe Linoff
Sent: Monday, November 05, 2012 11:55 AM
To: Henrik Ahlgren
Cc: libvirt-users at redhat.com
Subject: Re: [libvirt-users] re-create disk image file

Hi Henrik:

Thank you. Both suggestions are excellent.

Have you noticed spam messages from this email list? I have gotten
several in the past couple of days. 

Regards,

Joe

-----Original Message-----
From: Henrik Ahlgren [mailto:pablo at seestieto.com]
Sent: Monday, November 05, 2012 11:53 AM
To: Joe Linoff
Cc: libvirt-users at redhat.com
Subject: Re: [libvirt-users] re-create disk image file

On Mon, Nov 05, 2012 at 11:03:11AM -0800, Joe Linoff wrote:
> I am curious about how to re-create a disk image file from a running 
> guest when the original disk image file is accidentally deleted. This 
> came up recently during a test scenario but I couldn't figure out how 
> to do it.

If you have unlinked the image, but qemu-kvm (or whatever hypervisor you
are running) still has it open, you should be able to to recover it by
going to /proc/PID/fd and looking for a file descriptor number that is a
symlink to your deleted image. Just copy it to a safe place. I would
first run sync inside the guest and maybe suspend it. It would be nice
if you could switch it to single user mode with all filesystems mounted
read-only, but whatever you do, avoid destroying the domain.

Or why not just attach a new disk to the guest and copy stuff inside the
guest?


_______________________________________________
libvirt-users mailing list
libvirt-users at redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-users




More information about the libvirt-users mailing list