Directory /root deleted
I just noticed about an hour ago that my directory /root has disappeared. I was logged in as root in order to do some CVS maintenance but in looking over my shell history I can't find any command that I might have given that would have deleted it ... oh well maybe it happened a few days ago and I didn't realize it since I rarely log in as root. My question is: How can I reconstruct the /root directory? Second question is What is is the /root directory of any importance apart from .Xauthority? TIA, Patrick
Hi, Patrick J. Hays schrieb:
My question is: How can I reconstruct the /root directory? Second question is What is is the /root directory of any importance apart from .Xauthority?
Search at google for "recover" "ext3" or "ext2" or "reiserfs" etc. or with "undelete" "undeleting" etc. If you use reiserfs on /root, you _could_ try root@localhost # umount -f /dev/$DEVICE root@localhost # reiserfsck --rebuild-tree --scan-whole-partition /dev/$DEVICE where $DEVICE is something like hde5 or sdb7 and so on. At the end you will have a lot of files and directories in /lost+found (or /root/lost+found set the case you have /root mounted separately from /) with numbers as names. A lot of old deleted files and dirs will be there, and maybe as well some or all of the files of your /root before you deleted it. The reiserfsck command from above is to put into one single command line. If you have ext2 you can play around with mc, it is said to have some undelete function implemented. If you use ext3 however, I read somewhere that this doesn't work. But you will find tools in the internet. You should know that - in my opinion - file recovery is a lot easier with reiserfs because there I think no tools for ext2/3 which will do almost all the work for you like reiserfs is able to. If you are using another file system - I just don't know. I should add that the above said is no real reason to favor ReiserFS because there will always be a tradeoff with a file system having a good recovering ability against speed etc. So please make backups from important data and use a "fast" and "stable" file system. _I_ had to learn this, as you can see from a thread some weeks ago. But I was lucky indeed at the end to have used reiserfs. But today I would not use it again because of everything said here. Regards, Re
On Wednesday 14 May 2003 18:20, Patrick J. Hays wrote:
My question is: How can I reconstruct the /root directory?
mkdir /root chmod 700 /root cp -a /etc/.skel/* /root/ for i in /etc/skel/.*; do [ "$i" = "/etc/skel/." -o "$i" = "/etc/skel/.." ] || cp -a $i /root/; done
Second question is What is is the /root directory of any importance apart from .Xauthority?
.Xauthority isn't important. If it isn't there it will be reconstructed the next time you start X. It's only important in that it can screw up sux, kdesu and other "run X programs as root" things if it isn't correct. I don't think there's anything especially important in there, it just needs to be there so you can log in properly in case you have to do systems maintenance. Apart from that, /root is just another user account home directory
Anders Johansson wrote:
On Wednesday 14 May 2003 18:20, Patrick J. Hays wrote:
My question is: How can I reconstruct the /root directory?
mkdir /root chmod 700 /root cp -a /etc/.skel/* /root/ for i in /etc/skel/.*; do [ "$i" = "/etc/skel/." -o "$i" = "/etc/skel/.." ] || cp -a $i /root/; done
Second question is What is is the /root directory of any importance apart from .Xauthority?
.Xauthority isn't important. If it isn't there it will be reconstructed the next time you start X. It's only important in that it can screw up sux, kdesu and other "run X programs as root" things if it isn't correct.
I don't think there's anything especially important in there, it just needs to be there so you can log in properly in case you have to do systems maintenance. Apart from that, /root is just another user account home directory
Thanks for script; I'll give it a try in the morning. Mostly I'm glad to hear that nothing critical is in /root. I normally backup /home, /var and others but somehow passed up /root. It now joins the list TO-BE-BACKED-UP-RELIGIOUSLY. Patrick
participants (3)
-
Anders Johansson
-
Patrick J. Hays
-
René Matthäi