LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 07-08-2007, 03:56 PM   #1
Sangaho
LQ Newbie
 
Registered: Jul 2007
Posts: 4

Rep: Reputation: 0
Undeleting /home/$username on ext3


Hi,

I have the following problem: I wanted to create a kde-devel account on a different partition than the one my system (Ubuntu Feisty) is installed on. So I mounted the partition as /media/dev7, and then did a
Code:
sudo mount /media/dev7 /home --bind
Not knowing what I just did, I added a new user "kde-devel" and created the new home dir in /home/kde-devel, not noticing that my own one (/home/joh) was gone...
So, after some time, I did notice it, and looked for a tool to recover folders on ext3. Apparently, it's not possible since ext3 completely zeroes out the files and folders, instead of just marking them as free space on the hdd.
But in my case, I did not use "rm".
I could figure out the inodes of all the (now invisible) folders, including /home/joh, and all the subdirs using a little tool called "giis", even though it's only able to recover files deleted after the installation.

Is there a way to undelete/recover a folder if I know its inode?

Joh
 
Old 07-08-2007, 05:02 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Restore from backup. If you don't take backups, now you know why you need to.
 
Old 07-08-2007, 05:24 PM   #3
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
I guess all you can do is get photorec. If it's your personal data you're after, you should find it quite reliable (although far from perfect with multimedia files as I found out). It doesn't recover folders, only individual files. The original names are lost so there will be quite a bit of sorting if you had many files; on the other hand, photorec allows specifying the exact sort of files you need to recover. And yes, ext3 is a bit problematic in such a case but it's usually not as bad as it sounds.

Last edited by jay73; 07-08-2007 at 05:25 PM.
 
Old 07-08-2007, 06:21 PM   #4
rupertwh
Member
 
Registered: Sep 2006
Location: Munich, Germany
Distribution: Debian / Ubuntu
Posts: 297

Rep: Reputation: 49
Quote:
Originally Posted by Sangaho
Is there a way to undelete/recover a folder if I know its inode?
The way I understand you, your files have not been deleted at all. You just mounted another partition on top of them. If you unmount your current /home, the old files will be accessible again. Move them to a temporary directory (outside /home obviously), then remount /home.
 
Old 07-08-2007, 06:52 PM   #5
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Quote:
Originally Posted by rupertwh
The way I understand you, your files have not been deleted at all. You just mounted another partition on top of them. If you unmount your current /home, the old files will be accessible again. Move them to a temporary directory (outside /home obviously), then remount /home.
I think you're right. It sounds like the original /home directory contents are hiding under the mounted partition.
 
Old 07-08-2007, 07:10 PM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Yes, rupertwh is correct. The kde-devel account doesn't need to have its home directory under /home. You could have a /home2 directory and use that. As long as the /etc/passwd entry has /home2/kde-devel as the homepage, it would be fine.
 
Old 07-09-2007, 08:12 AM   #7
Sangaho
LQ Newbie
 
Registered: Jul 2007
Posts: 4

Original Poster
Rep: Reputation: 0
You were all right. I just rebooted the computer and everything was fine again. Puhh..
Thanks for your help!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Constrain user to /home/username directory General Linux - Security 3 04-05-2007 01:52 AM
Newb locked out of /home/username? Charlie Spencer Linux - Newbie 7 07-21-2006 12:18 AM
Writing a script to backup up /home/username ginda Programming 3 01-05-2006 06:47 AM
undeleting ext3 files cccc Linux - General 2 07-31-2005 06:23 AM
Xauth will not unlock a file at /home/username javpra Linux - Newbie 3 09-08-2004 07:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 05:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration