Radu Stanescu
2007-Feb-02 12:46 UTC
[Xen-users] HELP PLEASE !! How to Recover deleted img file?
Hy today I accidentaly delete the img file of one of my domU. The guest is still up and running. How can i recover the img file from which it was loaded? I tried lsof but i don''t see any open file by xen regarding my domU Thanks! -- Radu Stanescu _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Henning Sprang
2007-Feb-02 13:15 UTC
Re: [Xen-users] HELP PLEASE !! How to Recover deleted img file?
On 2/2/07, Radu Stanescu <radukn@gmail.com> wrote:> Hy today I accidentaly delete the img file of one of my domU. The guest is > still up and running.Interesting, can you even login, and the system still works? Then Xen is saving the file from being deleted totally until the vm is shut down. After that, it will probably free the open file, and it will be gone. So don''t stop the vm, and do a full rsync backup ASAP.>How can i recover the img file from which it was > loaded? > I tried lsof but i don''t see any open file by xen regarding my domUThis is a generic linux problem and has nothing to do with Xen. I think, if you once stop the vm and have not done an rsaync backup as said above, you have not much chances, but at very first, you should stop the machine completely and not use the harddisk where the lost image resided. Go to linux recovery mailing lists and read about that. As far as I know, when you don''t use special techniques in advance, (there is some libraray that makes rm not really delete stuff, AFAIK, and for sure we all have backups, at least _after_ we lost important data the first time, right?!), it''s absolitely not easy to recover lost files. Heninng _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Ligesh
2007-Feb-02 13:22 UTC
[Xen-users] Re: HELP PLEASE !! How to Recover deleted img file?
On Fri, Feb 02, 2007 at 02:15:30PM +0100, Henning Sprang wrote:> On 2/2/07, Radu Stanescu <radukn@gmail.com> wrote: > >Hy today I accidentaly delete the img file of one of my domU. The guest is > >still up and running. > > Interesting, can you even login, and the system still works? > Then Xen is saving the file from being deleted totally until the vm is > shut down. After that, it will probably free the open file, and it > will be gone. > > So don''t stop the vm, and do a full rsync backup ASAP. >Not xen. It is a property of the unix kernel. It won''t delete the file unless the open file descriptor count is 0. Maybe if you ask in the linux kernel mailing list, someone might be able to help you out. Thanks. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Petersson, Mats
2007-Feb-02 13:27 UTC
RE: [Xen-users] HELP PLEASE !! How to Recover deleted img file?
> -----Original Message----- > From: xen-users-bounces@lists.xensource.com > [mailto:xen-users-bounces@lists.xensource.com] On Behalf Of > Henning Sprang > Sent: 02 February 2007 13:16 > To: Radu Stanescu > Cc: xen-users@lists.xensource.com > Subject: Re: [Xen-users] HELP PLEASE !! How to Recover > deleted img file? > > On 2/2/07, Radu Stanescu <radukn@gmail.com> wrote: > > Hy today I accidentaly delete the img file of one of my > domU. The guest is > > still up and running. > > Interesting, can you even login, and the system still works? > Then Xen is saving the file from being deleted totally until the vm is > shut down. After that, it will probably free the open file, and it > will be gone. > > So don''t stop the vm, and do a full rsync backup ASAP.That seems like good solution to me. You could even attach another disk-device and copy to that (xm block-attach DomID BackDev FrontDev Mode [BackDomain] is the command to use). Of course, you can''t save things that aren''t files, but at least if you have some important data on file(s) in the domain, you can save those. Anything else should be salvagable by re-installing the OS + apps.> > >How can i recover the img file from which it was > > loaded? > > I tried lsof but i don''t see any open file by xen regarding my domU > > This is a generic linux problem and has nothing to do with Xen.Yes. Linux (like all Unix versions) will keep the file alive but invisible until the last user of the file closes it. Since it''s an image file, there''s most likely only one user of the file, and that''s the VM itself (or more precisely, the part of Dom0 that manages your image-file to disk translation for the DomU).> > I think, if you once stop the vm and have not done an rsaync backup as > said above, you have not much chances, but at very first, you should > stop the machine completely and not use the harddisk where the lost > image resided. > > Go to linux recovery mailing lists and read about that. > > As far as I know, when you don''t use special techniques in advance, > (there is some libraray that makes rm not really delete stuff, AFAIK, > and for sure we all have backups, at least _after_ we lost important > data the first time, right?!), it''s absolitely not easy to recover > lost files.Indeed. It used to be very easy in the old days with DOS (as long as new data wasn''t added to the disk), but modern file-systems aren''t quite so trivially designed, and to modify the right places to recover files within the filesystem gets very hairy very quickly. Best way is to save what you can from inside the VM, and recreate what you can''t save - you''ll waste much more time trying to recover the file itself, for no real value. -- Mats> > Heninng > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users > > >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Radu Stanescu
2007-Feb-02 13:39 UTC
[Xen-users] Re: HELP PLEASE !! How to Recover deleted img file?
Hewh! I did it! I recovered my img file! :D Ext3 doesn''t permite undelete, but hopefully xen mount img file as loop devices so doing a "losetup -a" will show xen mounted devices then with dd you can recover from the /dev/loopXX to a img file. It is recommended to stop on the domU all daemons that could write anything to the hdd while doing the dd. after recovery, fsck the recovered file and recreate the vm from the recovered file. Thank you very much for you help guys! On 2/2/07, Radu Stanescu <radukn@gmail.com> wrote:> > Hy today I accidentaly delete the img file of one of my domU. The guest is > still up and running. How can i recover the img file from which it was > loaded? > I tried lsof but i don''t see any open file by xen regarding my domU > > Thanks! > > -- > Radu Stanescu > >-- Radu Stanescu Best Internet Security Systems www.biss.ro radukn@gmail.com radukn@biss.ro 0722.234.788 _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Henning Sprang wrote:> On 2/2/07, Radu Stanescu <radukn@gmail.com> wrote: >> Hy today I accidentaly delete the img file of one of my domU. The >> guest is >> still up and running. > > Interesting, can you even login, and the system still works? > Then Xen is saving the file from being deleted totally until the vm is > shut down. After that, it will probably free the open file, and it > will be gone. > > So don''t stop the vm, and do a full rsync backup ASAP. > >> How can i recover the img file from which it was >> loaded? >> I tried lsof but i don''t see any open file by xen regarding my domU > > This is a generic linux problem and has nothing to do with Xen. > > I think, if you once stop the vm and have not done an rsaync backup as > said above, you have not much chances, but at very first, you should > stop the machine completely and not use the harddisk where the lost > image resided. > > Go to linux recovery mailing lists and read about that. > > As far as I know, when you don''t use special techniques in advance, > (there is some libraray that makes rm not really delete stuff, AFAIK, > and for sure we all have backups, at least _after_ we lost important > data the first time, right?!), it''s absolitely not easy to recover > lost files. > > Heninng > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users > > >This site may be of some help. http://e2undel.sourceforge.net/recovery-howto.html _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Ulrich Windl
2007-Feb-02 14:52 UTC
Re: [Xen-users] HELP PLEASE !! How to Recover deleted img file?
On 2 Feb 2007 at 14:46, Radu Stanescu wrote:> Hy today I accidentaly delete the img file of one of my domU. The guest is > still up and running. How can i recover the img file from which it was > loaded? > I tried lsof but i don''t see any open file by xen regarding my domUUNIX semantics mean that the file will go away once it''s no longer open. Can you do something like (please refine!) in DomU?: tar cf - / | rsh server_with_lots_of_space "cat >backup.tar" You could also try a blockwise dd of the partitions, but I would not recommend it. Ulrich _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Tim Post
2007-Feb-02 14:59 UTC
Re: [Xen-users] HELP PLEASE !! How to Recover deleted img file?
On Fri, 2007-02-02 at 14:46 +0200, Radu Stanescu wrote:> Hy today I accidentaly delete the img file of one of my domU. The > guest is still up and running. How can i recover the img file from > which it was loaded? > I tried lsof but i don''t see any open file by xen regarding my domU > > Thanks! > > -- > Radu Stanescu >If anything, Xen has more or less acted like a safety net. The file you deleted isn''t deleted (yet) because something is still accessing (lock ! = 0) it. What I would do is create a second loop device large enough to hold your data, xm block-attach it after formatting it mount it and back up any way you see fit. Remember, don''t include the backup drive itself in the copy / rsync / tar (whatever, you get the picture). A slower method would be just fire up rsync (use ssh if weary of trying to install rsyncd on the phantom system). Grab as if you would in a burning building, and whatever you do , don''t stop the VM :) Hope this helps, --Tim> _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users