Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.]
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.
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.
-->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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.