LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-24-2004, 03:43 AM   #1
chii-chan
Member
 
Registered: Sep 2003
Location: chikyuu (E103N6)
Distribution: Redhat 8.0 (2.4.25-custom), Fedora Core 1 (2.4.30-custom)
Posts: 357

Rep: Reputation: 30
Using undel command in debugfs


Hi

How do I 'undel' a file with certain inode to main disk. Let say, I unmount /dev/hda2 (ext2fs), and open the disk with 'debugfs /dev/hda2' with read only option. And I want to save the file in my home directory in /dev/hda1. Then in debugfs I type 'undel xxxxxinode /home/chiichan/aaa.file'. It says cannot save file/or something like that, disk in readonly mode. Why it can't find the /home/chiichan in /dev/hda1? I already lcd to root directory and I also tried lcd to /home/chiichan. How do I pass the command so that it will save the undeleted file in my home directory instead of the current disk (/dev/hda2)? Help would be really appreciated . [Note: I can undel to the current disk if I use debugfs in read/write mode.]
 
Old 02-24-2004, 04:14 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
"How do I pass the command so that it will save the undeleted file in my home directory instead of the current disk (/dev/hda2)?"

Here is my guess:

debugfs -R cat <inode#> > /home/chiichan/my.new.file

___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites
 
Old 02-25-2004, 07:57 PM   #3
chii-chan
Member
 
Registered: Sep 2003
Location: chikyuu (E103N6)
Distribution: Redhat 8.0 (2.4.25-custom), Fedora Core 1 (2.4.30-custom)
Posts: 357

Original Poster
Rep: Reputation: 30
Thanks, I haven't tried it yet. Can it be something like this:

debugfs -R undel <inode#> /home/chiichan/xxx.file ?

Any other suggestions?
 
Old 02-25-2004, 08:25 PM   #4
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
"debugfs -R undel <inode#> /home/chiichan/xxx.file ?"

needs another > to redirect standard output to a file.
debugfs -R undel <inode#> > /home/chiichan/xxx.file

My man debugfs does not show any undel command.

Here is an online man page for debugfs and it doesn't show undel either:

http://www.die.net/doc/linux/man/man8/debugfs.8.html

___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites

Last edited by jailbait; 02-25-2004 at 08:28 PM.
 
Old 02-25-2004, 08:57 PM   #5
chii-chan
Member
 
Registered: Sep 2003
Location: chikyuu (E103N6)
Distribution: Redhat 8.0 (2.4.25-custom), Fedora Core 1 (2.4.30-custom)
Posts: 357

Original Poster
Rep: Reputation: 30
Hi

It is in my debugfs. I run the program> help and it list down the commands including undel command. However, I can't find the undel command in the man page. May be the man page is not updated.
 
Old 02-25-2004, 09:35 PM   #6
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
Since you are using the read only option then you should not hurt anything on /dev/hda2. So I think that you should try the different possible debugfs commands and see if you can get one of them to work.

I read the debugfs -R help and it did not tell me much about undel. My guess is that undel changes an inode on /dev/hda2 so that the file is now existing again. I do not think that undel will work in read only mode. But it should not hurt anything to try undel in read only mode.

I think that first you should try to copy the deleted file to your home directory with cat. If you cannot get that to work then try undel in read only mode. If that does not work then try undel in write mode.

___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites

Last edited by jailbait; 02-25-2004 at 09:36 PM.
 
Old 03-01-2004, 07:16 PM   #7
chii-chan
Member
 
Registered: Sep 2003
Location: chikyuu (E103N6)
Distribution: Redhat 8.0 (2.4.25-custom), Fedora Core 1 (2.4.30-custom)
Posts: 357

Original Poster
Rep: Reputation: 30
Hi

I tried the following commands:

debugfs /dev/hda2 cat inode_# > /home/chiichan/file

--> did not work, it said file name unknown; cat <file> <destination_file>

debugfs /dev/hda2 undel inode_# > /home/chiichan/file

-->did not work, it said should be without '>'

debugfs /dev/hda2 undel inode_# /home/chiichan/file

-->did not work, it said destination unknown

so I tried in debugfs prompt:

debugfs: cat inode_# > /home/chiichan/file

-->file name unknown, cat <file> > <destination_file>

debugfs: dump inode_# /home/chiichan/file

-->file name unknown, dump <file> <destination_file>

debugfs: undel inode_# /home/chiichan/file

-->destination unknown

debugfs: undel inode_# file

-->read only filesystem

So, I open /dev/hda2 in read-write mode:

debugfs: undel inode_# file

-->Successful

So, I the debugfs can't find the other filesystem other than the currently opened /dev/hda2. Using debugfs in read-write mode seem to be the only solution.
 
  


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
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 02:23 AM
Redirecting output to a command-line argument of another command madiyaan Linux - Newbie 1 02-19-2005 04:35 PM
batch commands to debugfs with a read-only filesystem billhowe Red Hat 1 08-21-2004 11:02 AM
Key stroke/command to shut down x and go into the command prompt screen? Fear58 Linux - General 1 07-14-2004 07:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:02 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