LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 03-14-2008, 02:31 AM   #1
josephj
Member
 
Registered: Nov 2007
Location: Northeastern USA
Distribution: kubuntu
Posts: 80

Rep: Reputation: 28
Getting past disk errors resizing partitions


I'm running kubuntu gutsy on my notebook.

I just deleted my dapper partition /dev/sda2 successfully.

When I use gparted to try to grow /dev/sda4 (gutsy) to use all that space, it fails on a read error.

I went back into gparted and created an ext3 partition on /dev/sda2.

I rebooted and ran fsck -CVa /dev/sda2 and it says it's clean - no errors.

It looks like I need to map out some bad sectors on my drive in that partition.

What should I do next - leaving my other partitions intact?

I just ran fsck (below) on it and it found and "fixed" 10 bad blocks.
Since it just puts them in a file of bad blocks, it doesn't do anything
that will help gparted get past them.

I just read an article
http://www2.uic.edu/~aciani1/sector_blues.html#3.0 that says modern disks don't let you map out bad blocks/sectors any more. It says if you try to write to the bad blocks, the drive maps them out itself until it runs out of spare blocks. So I ran fsck again forcing non-destructive writes. I thought that might have fixed it but gparted still failed (see below).

So, do I need a new hard disk or what?

Joe

1st fsck:

bigbird@sananda:~$ sudo fsck.ext3 -cfv /dev/sda2
[sudo] password for bigbird:
e2fsck 1.40.2 (12-Jul-2007)
Checking for bad blocks (read-only test): done
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

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

11 inodes used (0.00%)
1 non-contiguous inode (9.1%)
# of inodes with ind/dind/tind blocks: 0/0/0
133920 blocks used (1.72%)
10 bad blocks
1 large file

0 regular files
2 directories
0 character device files
0 block device files
0 fifos
0 links
0 symbolic links (0 fast symbolic links)
0 sockets
--------
2 files

2nd fsck:

bigbird@sananda:~$ sudo fsck.ext3 -Cfv -c -c /dev/sda2
[sudo] password for bigbird:
e2fsck 1.40.2 (12-Jul-2007)
Checking for bad blocks (non-destructive read-write test)
Testing with random pattern: 2316936/ 7805580294728/ 7805580 7805580
done
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

/dev/sda2: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sda2: 11/3908128 files (9.1% non-contiguous), 133918/7805581 blocks
bigbird@sananda:~$

Saved gparted log:

GParted 0.3.4

Libparted 1.7.1


Delete /dev/sda2 (ext2, 29.78 GiB) from /dev/sda 00:01 ( SUCCES )

calibrate /dev/sda2 00:00 ( SUCCES )

path: /dev/sda2
start: 81915435
end: 144360089
size: 62444655 (29.78 GiB)
delete partition 00:00 ( SUCCES )

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


Grow /dev/sda4 from 38.40 GiB to 68.18 GiB 07:55 ( ERROR )

calibrate /dev/sda4 00:00 ( SUCCES )

path: /dev/sda4
start: 144360090
end: 224893934
size: 80533845 (38.40 GiB)
calculate new size and position of /dev/sda4 00:00 ( SUCCES )

requested start: 81915435
requested end: 224893934
requested size: 142978500 (68.18 GiB)
new start: 81915435
new end: 224893934
new size: 142978500 (68.18 GiB)
check filesystem on /dev/sda4 for errors and (if possible) fix them
03:45 ( SUCCES )

e2fsck -f -y -v /dev/sda4

Superblock last write time is in the future. Fix? yes

Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

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

210866 inodes used (4%)
8679 non-contiguous inodes (4.1%)
# of inodes with ind/dind/tind blocks: 13816/1433/1
7774699 blocks used (77%)
0 bad blocks
2 large files

175937 regular files
17286 directories
329 character device files
26 block device files
2 fifos
1369 links
17262 symbolic links (15692 fast symbolic links)
15 sockets
--------
212226 files

e2fsck 1.39 (29-May-2006)

move partition to the left 00:00 ( SUCCES )

old start: 144360090
old end: 224893934
old size: 80533845 (38.40 GiB)
new start: 81915435
new end: 162449279
new size: 80533845 (38.40 GiB)
move filesystem to the left 04:10 ( ERROR )

perform readonly test 04:10 ( ERROR )

using internal algorithm
read 80533845 sectors
finding optimal blocksize

read 32768 sectors using a blocksize of 128 sectors 00:01 ( SUCCES )

32768 of 32768 read
0.692194 seconds
read 32768 sectors using a blocksize of 256 sectors 00:00 ( SUCCES )

32768 of 32768 read
0.538741 seconds
read 32768 sectors using a blocksize of 512 sectors 00:01 ( SUCCES )

32768 of 32768 read
0.545907 seconds
optimal blocksize is 256 sectors (128.00 KiB)
read 80435541 sectors using a blocksize of 256 sectors 04:08 ( ERROR )

11092565 of 80435541 read
Error while reading block at sector 155550959
11190869 sectors read
rollback last change to the partitiontable 00:00 ( SUCCES )

move partition to the right 00:00 ( SUCCES )

old start: 81915435
old end: 162449279
old size: 80533845 (38.40 GiB)
new start: 144360090
new end: 224893934
new size: 80533845 (38.40 GiB)
libparted messages ( INFO )

Input/output error during read on /dev/sda
 
Old 03-14-2008, 08:03 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,818

Rep: Reputation: 327Reputation: 327Reputation: 327Reputation: 327
Quote:
I rebooted and ran fsck -CVa /dev/sda2 and it says it's clean - no errors.

It looks like I need to map out some bad sectors on my drive in that partition.
I must be missing something here. How do you conclude that you have bad sectors? Did you run badblocks and forget to mention it?

If my own experience with partition manipulations, I've generally created problems for myself which gave me read errors and partition overlap errors. It may be my technique using the partitioning tools that is at fault, or it may be my understanding of how to manipulate partitions that is at fault. At any rate, I have learned how to protect myself from my failings in re partitioning.

This is what I have learned: when I propose to delete a partition, then resize another to take up the free space, it's best to delete the partition, then reboot. If I understand the reason correctly, it's because on boot, a partition table is loaded into kernel memory. When I delete a partition, then try to expand another into the free space, I have two different partition tables in conflict: the one that existed when I booted up, and the one that exists after deleting a partition. By rebooting after deleting a partition, and before trying to use the free space, I have removed the potential for conflicting partition tables.

Then I can resize a partition to take up the free space. Before trying to use the newly expanded partition, I reboot once more to have the correct partition table in use.
 
Old 03-15-2008, 10:15 AM   #3
josephj
Member
 
Registered: Nov 2007
Location: Northeastern USA
Distribution: kubuntu
Posts: 80

Original Poster
Rep: Reputation: 28
Good advice.

Running fsck.ext3 (e2fsck) with -f forces it to do a full check even if things look OK.
Using -c invokes the badblocks program and specifying it twice causes non-destructive write testing as well.

The first e2fsck output says "10 bad blocks".

The deletion of my /dev/sda2 partition did succeed. It is no longer there. It's just free space. Running gparted still fails, so I don't believe a modified partition table is the issue.

I think I could just make the space back into a separate partition and use mount --bind to make it look like part of the /dev/sda4 partition, but I'm not sure if that's a good idea.

Joe
 
Old 07-13-2009, 06:41 PM   #4
josephj
Member
 
Registered: Nov 2007
Location: Northeastern USA
Distribution: kubuntu
Posts: 80

Original Poster
Rep: Reputation: 28
Current method

I still don't have it down, but I got past the problem in the process of replacing the drive. I have Linux on an ext3 partition.

What I did was unmount the drive (I did it by removing it and making it an unmounted usb drive, but it would work just as well from a live cd or rescue disk).

Then I ran
e2fsck -fvcck /dev/sdb2

Substitute the correct device node for your drive.
Running fdisk -l will help you figure out which device to use if you're not sure where Linux put it.

This does a (long!) non-destructive write test on your disk (cc) and adds (k) any new bad blocks to those already in the bad blocks inode.

It forces (f) the check to be run even if Linux thinks the drive is OK and since it runs for a very long time, it is set to verbose (v) so you have some idea of how it's progressing.

On a lighter note, the options are easy to remember in this order because they mimic the expletive you may have just issued when you found the problem in the first place.

Joe
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
NFS errors for the past few days dougtheslug Linux - Server 14 03-12-2008 01:06 PM
Resizing Partitions dokunut Linux - Newbie 2 06-18-2005 08:56 PM
Resizing partitions ?? sachinh Linux - General 1 04-04-2005 06:01 AM
resizing partitions jayakrishnan Linux - General 5 05-06-2002 01:32 AM
resizing partitions suselinux Linux - General 7 09-07-2001 07:28 AM


All times are GMT -5. The time now is 09:23 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration