Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Update: running testdisk I can actually see all of my files in /dev/sda1!

I wanted to install Windows alongside my Debian installation in order to play some games. In order to do that, I had to boot up a Ubuntu Live 12.1 DVD and use GParted (I was resizing my main partition which had everything).

The resizing finished successfully. I then tried to reboot into my Debian to backup my data, which I had forgotten to do before unfortunately...

GRUB loads nicely, but the system cant boot properly! It comes to a point where it tries to configure a "ramdisk", or something like that; then it's just a prompt and that's it.

Now I've booted into Ubuntu again, to run a check on my shrank partition. Essentially, it's broken, but I can't really understand the error message.

This is what GParted reported:

GParted 0.12.1 --enable-libparted-dmraid

Libparted 2.3
Check and repair file system (ext3) on /dev/sda1  00:11:35    ( ERROR )

calibrate /dev/sda1  00:00:00    ( SUCCESS )

path: /dev/sda1
start: 2,048
end: 1,232,117,759
size: 1,232,115,712 (587.52 GiB)
check file system on /dev/sda1 for errors and (if possible) fix them  00:11:35    ( ERROR )

e2fsck -f -y -v /dev/sda1

ext2fs_check_desc: Corrupt group descriptor: bad block for block bitmap
e2fsck: Group descriptors look bad... trying backup blocks...
Block bitmap for group 4700 is not in group. (block 154014812)
Relocate? yes

Inode bitmap for group 4700 is not in group. (block 154014813)
Relocate? yes

Pass 1: Checking inodes, blocks, and sizes
Error allocating 1 contiguous block(s) in block group 4700 for block bitmap: Could not allocate block in ext2 filesystem
Error allocating 1 contiguous block(s) in block group 4700 for inode bitmap: Could not allocate block in ext2 filesystem

/dev/sda1: ***** FILE SYSTEM WAS MODIFIED *****

/dev/sda1: ********** WARNING: Filesystem still has errors **********

e2fsck 1.42.5 (29-Jul-2012)
e2fsck: aborted

========================================

This is the output of dmesg | tail:

[ 1702.169848] EXT3-fs error (device sda1): ext3_check_descriptors: Block bitmap for group 4700 not in group (block 154014812)!
[ 1702.170231] EXT3-fs (sda1): error: group descriptors corrupted
[ 1889.324746] CPU3: Package power limit notification (total events = 50)
[ 1889.324749] CPU1: Package power limit notification (total events = 50)
[ 1889.324750] CPU2: Package power limit notification (total events = 50)
[ 1889.324752] CPU0: Package power limit notification (total events = 50)
[ 1889.335756] CPU2: Package power limit normal
[ 1889.335757] CPU3: Package power limit normal
[ 1889.335759] CPU1: Package power limit normal
[ 1889.335760] CPU0: Package power limit normal

How can I fix my partition? Will I be able to recover my data?

Edit:

Here are some additional commands I ran:

sudo fsck.ext3 -cf /dev/sda1

e2fsck 1.42.5 (29-Jul-2012)
ext2fs_check_desc: Corrupt group descriptor: bad block for block bitmap
fsck.ext3: Group descriptors look bad... trying backup blocks...
Block bitmap for group 4700 is not in group.  (block 154014812)
Relocate<y>? yes
Inode bitmap for group 4700 is not in group.  (block 154014813)
Relocate<y>? yes
fsck.ext3: e2fsck_read_bitmaps: illegal bitmap block(s) for /dev/sda1

/dev/sda1: ***** FILE SYSTEM WAS MODIFIED *****

sudo e2fsck -b 32768 /dev/sda1

e2fsck 1.42.5 (29-Jul-2012)
Block bitmap for group 4700 is not in group.  (block 154014812)
Relocate<y>? yes
Inode bitmap for group 4700 is not in group.  (block 154014813)
Relocate<y>? yes
/dev/sda1 was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Error allocating 1 contiguous block(s) in block group 4700 for block bitmap: Could not allocate block in ext2 filesystem
Error allocating 1 contiguous block(s) in block group 4700 for inode bitmap: Could not allocate block in ext2 filesystem
e2fsck: aborted

/dev/sda1: ***** FILE SYSTEM WAS MODIFIED *****

/dev/sda1: ********** WARNING: Filesystem still has errors **********

sudo parted -l

Model: ATA Hitachi HTS54757 (scsi)
Disk /dev/sda: 750GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos

Number  Start   End    Size    Type     File system     Flags
 1      1049kB  631GB  631GB   primary  ext3            boot
 2      742GB   750GB  7985MB  primary  linux-swap(v1)


Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0
has been opened read-only.
Error: Can't have a partition outside the disk!                           

The partition table entry states "msdos" - is this supposed to be like that?

share|improve this question
    
Links as answeres are not allowed thus here... :-) I found two pages that seem promising in this context: forums.gentoo.org/… and r-tt.com Most of the postings I found about these error messages seem to have resulted in complete FS loss. –  Hauke Laging Mar 12 '13 at 23:57
1  
looking at you parted -l /dev/sda where is the partition that you created for your windows installation? –  cinelli Mar 13 '13 at 0:41
    
Did you happen to move the partition to the right when you shrunk it so there would be room at the start for windows? –  psusi Mar 13 '13 at 1:18
add comment

1 Answer

up vote 1 down vote accepted

Try booting back into a live environment and without any of your system's partitions run fsck.ext3 -pcf on the drive in question. If fsck.ext3 isn't available then e2fsck -pcf will work fine.

The flags used will tell fsck.ext3 to behave as follows:

-p, Automatic repair (no questions)
-c, Check for bad blocks and add them to the badblock list
-f  Force checking even if filesystem is marked clean

If this doesn't work, run fdisk /dev/sda and use the option to verify the partition table. I believe this option is v

share|improve this answer
    
fsck.ext3 -pcf complained about the -p option, so I removed it. After that it asked me two questions about reallocation, to both of which I had answered "yes". To see the exact output please check out my edit, but I don't think it succeeded in anything... –  akled Mar 12 '13 at 23:32
1  
Booting from another medium is a good idea but the badblocks search may take an eternity. There was nothing about hardware errors in the dmesg output. –  Hauke Laging Mar 12 '13 at 23:42
    
@HaukeLaging: I was writing all of this while having booted from a LiveCD. And what do you mean by eternity? An eternity for me to detect the problem, or an eternity for a program to do it? Few hours or potentially never? –  akled Mar 12 '13 at 23:45
    
@Yannbane I don't think that searching for badblocks (which may take hours) will solve your problem. That's of no use IMHO if the kernel (dmesg) does not complain about hardware errors. You have a software problem not a hardware problem (even if the original problem was caused by hardware). –  Hauke Laging Mar 12 '13 at 23:54
    
I don't know... I'm pretty sure my HDD is OK, in fact, I can see all the /dev/sda1 files with testdisk! –  akled Mar 12 '13 at 23:59
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.