Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I get this error when mounting a drive

[ 4337.380506] EXT4-fs (sda): bad geometry: block count 156282966 exceeds size of device (156282701 blocks)

So if I try to fix it with sfdisk do I need space for the entire drive (640gb) or just as much as the data that is on the disk contains? (about 400gb)

backup like so

sfdisk -d /dev/sda > PT.txt

I'm trying to follow this help here - http://ubuntuforums.org/showpost.php?p=9485779&postcount=7

share|improve this question

1 Answer 1

Hmm. I've never tried to recover from such a situation. However, if you've got valuable data on that disk, I strongly recommend making a complete image of the disk before doing anything else. That means you'll need a device with at least as much free space as your disk has. Then do

dd if=/dev/sda of=/path/to/image.img

That way, if something goes wrong, you won't lose anything.


If you don't have enough space on a single partition, you might be able to work around that issue by doing something like this (WARNING: This is untested):

mkfifo /tmp/dd
dd if=/dev/sda of=/tmp/dd

Then, in another terminal, try this

split --bytes=4G /tmp/dd /path/to/staging/area # adjust size as appropriate

Finally, in a third terminal, you can quickly move the chunks to their permanent home, optionally compressing them first. Do this while dd runs. But whatever you do, make sure it's fast enough so that you don't run out of space in the staging area.

To restore the split files, you can do something like this:

Terminal 1:

mkfifo /tmp/dd
cat /path/to/chunks/dir/1/* /path/to/chunks/dir/2/* > /tmp/dd # List all chunks here

Use zcat instead of cat if you also need to uncompress the chunks.

Terminal 2:

dd if=/tmp/dd of=/dev/sda
share|improve this answer
    
I'm not trying to resize the partition, I'm trying to save the data on a disk with the error given in the first code bit. I really wish it was as easy as using gparted. I'm actually trying to follow inscructions from here ubuntuforums.org/showpost.php?p=9485779&postcount=7 where he had a similar problem. The difference is that I don't have a partition at all. (/dev/sda not /dev/sda1) –  winchendonsprings May 5 '11 at 18:49
    
@winchendonsprings: Thanks for clearing this up. I've edited my answer to reflect my current understanding of your problem. –  Scott Severance May 6 '11 at 5:50
    
That is certainly a clever way to manage moving the disk around. I never would have thought of that. I don't know if that is the route for me though, I understand what is going on but, I am definitely not a command line expert. Have you seen my post here? - askubuntu.com/questions/40211/… If you have any ideas on what to do there I'd love to know! Also thanks for taking the time to re-read this question. –  winchendonsprings May 7 '11 at 4:07
    
@winchendonsprings: I left a comment on your other question. I strongly recommend, though, that before you do anything potentially destructive, you make an image of your entire drive, just in case (unless you don't really care about your data). –  Scott Severance May 7 '11 at 8:47

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.