Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
I have an ext3 harddisk. Due to some unknown reasons, two partitions of it can no longer be mounted by the system, and give me an error message on loading GRUB.
Now it is hopeless to rescue the system. I just want to get back some important data. Are there any software to retrieve data from a partition of damaged filesystem (ext3)?
First, it's time for a change of mindset. If you come from the M$windows world, you are used to having to reinstall windows because windows doesn't provide the tools to make system repairs such as are available with Linux. You are used to thinking in terms of data recovery instead of system repair.
In the Linux world, unless you do something as root that damages the system, you can probably repair it, if you know what to do. If you don't know what to do, and are still fresh from the windows world, you will probably do the windows thing and think you need data recovery software, or that you need to reinstall.
Also in the Linux world, you shouldn't need data recovery tools, and you shouldn't need to reinstall, until you have used available tools to prove that data recovery or reinstallation are necessary.
Now to the proving the need for data recovery, or finding the repair to make the two partitions mountable.
Boot from a liveCD.
Check the file /etc/fstab (in the running OS) to see if the liveCD wrote anything for the two problem partitions, such as device names and mount points.
If they are not there, them make two mount points in the /mnt directory for the two partitions. In a terminal: mkdir /mnt/part-1; mkdir /mnt/part-2.
Run 'fdisk -l' (without quotes) to get the device names for the two partitions.
Mount the two partitions:
mount /dev/hdax /mnt/part-1
mount /dev/hday /mnt/part-2
where hdax if the first problem partition, and hday is the second.
Open your file manager and go to /mnt/part-1. Do you see files listed? If so, the partition is mountable.
Go the /mnt/part-2. Do you see files listed? If so, the partition is mountable.
The problem now comes down to this question: Why won't these two partition mount on boot?
At this point, you can try this:
Unmount the two partitions:
umount /dev/hdax
umount /dev/hday
Note: that's u-mount and not un-mount.
Run 'fsck /dev/hdax' followed by 'fsck /dev/hday' to see if fsck can repair the mountablity of the two partitions. Fsck must be run on unmounted partitions.
Shut down the liveCD, and reboot.
Take copious notes, copy the output of fdisk -l. Come back with more info on your partition setup, the output of fdisk -l, and any error messages you get along the way.
Thanks very much for your help. But I met problems during the process. When I follow your procedure until the mount step, the system said that I must specify the filesystem type in order to mount. So I added "-t ext3" into the command. Then it said that it could not detect any ext3 filesystem. But I am sure that my filesystem is an ext3 one...
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Uhm... this is the first time I see you are using a SCSI disk (or is it SATA?)
Try (as root)
cfdisk /dev/sdb
Are you able to see the partition table on the screen?
Do you see partition #1 and #2 being listed as ext3?
Whatever you do in that screen, DO NOT CHANGE ANYTHING AND DO NOT PRESS THE WRITE BUTTON!
You don't want to change anything, not just to 'try and see'. This is a dangerous tool, but the only one I can come up with quickly, and I would approach this problem myself like this.
If anyone can help me I would appreciate it. I am hesitant to try any steps found in this thread on my problem till someone tells me its ok. I would like to try to salvage as much data off my drive as possible.
lawrence_lee_lee, since you can't mount the partitions, there is a problem with the filesystem (but you knew that).
You now have several choices. First of all, try fsck. You need to do this on an unmounted partition anyway. man fsck to learn the details, but basically you would start with the command fsck /dev/sdb3.
If fsck gets you nowhere, then do an fdisk -l /dev/sdb and post the results here. There could be problems in your partition table.
I tried "cfdisk /dev/sdc3" (it become sdc because I plug into another linux machine to do the job), it did gave me some information as below:
==========================
cfdisk 2.12r
Disk Drive: /dev/sdc
Size: 250059350016 bytes, 250.0 GB
Heads: 255 Sectors per track: 63 Cylinders: 30401
Name Flags Part Type FS Type [Label] Size (MB)
sdc1 Primary Linux swap / Solaris 8192.38
sdc2 Primary Linux ext2 30721.43
sdc3 Primary Linux 184320.30
sdc4 Primary Linux ext2 26822.64
===========================
I also ran "fdisk -l /dev/sdc", it gave:
===========================
Disk /dev/sdc: 250.0 GB, 250059350016 bytes
255 heads, 63 sector/tracks, 30401 cylinders
Unit = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 996 8000338+ 82 Linux swap / Solaris
/dev/sdc2 997 4731 30001387+ 83 Linux
/dev/sdc3 4732 27140 180000292+ 83 Linux
/dev/sdc4 27141 30401 26193982+ 83 Linux
===========================
I've also tried fsck "/dev/sdc3", it gave:
===========================
fsck 1.40-WIP (14-Nov-2006)
e2fsck 1.40-WIP (14-Nov-2006)
Couldn't find ext2 superblock, trying backup blocks...
ext3 recovery flag is clear, but journal has data.
Recovery flag not set in backup superblock, so running journal anyway.
/dev/sdc3: recovering journal
fsck.ext2: Bad magic number in super-block while trying to re-open /dev/sdc3
Warning... fsck.ext2 for device /dev/sdc3 exited with signal 11.
===========================
If the drive is supposed to be an ext2/ext3 drive, rather than fsck, try e2fsck. You also should do a man e2fsck to learn about the options, and you might want to force it to run (the -f option).
fsck is supposed to invoke the correct file system repair program, but if it can't tell then it will fail to run. When you run e2fsck, you are saying "this drive has the ext2/3 file system on it; this is the proper utility to use".
Also, in Post 7 you referred to drive sdb and in post 11 you referred to drive sdc. Which is it?
The partition table listed by the flavors of fdisk looks reasonable; your problem isn't there unless something wrote a bogus (and fully consistent) partition table into your bootblock.
I've mentioned in my post 11 line 1 that, "...it become sdc because I plug into another linux machine to do the job...". Therefore, it become the sdc rather than sdb.
You said that my partition table looks reasonable. Doesn't this mean that it may be possible to recover my file system? Can I get back my files? If yes, that's sooooooooo good!!
Thanks a lot! You give me hope! I will try it out, e2fsck.
I've mentioned in my post 11 line 1 that, "...it become sdc because I plug into another linux machine to do the job...". Therefore, it become the sdc rather than sdb.
OK
Quote:
You said that my partition table looks reasonable. Doesn't this mean that it may be possible to recover my file system? Can I get back my files? If yes, that's sooooooooo good!!
Well, there is no obvious systemic reason why your file system can't be accessed. Can you recover it? That just depends on what has happened to it. If it is any of the "ordinary" problems, then e2fsck should fix you up. If you, for instance, deleted it by mistake or overwrite it using dd, then probably not.
Quote:
Thanks a lot! You give me hope! I will try it out, e2fsck.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.