Author Topic: Want to delete a bad partition, hard-disk may be dying [Answered and Solved]  (Read 1329 times)

Offline Vorteggs

  • Hero Member
  • *****
  • Posts: 2402
I sware...
I read relative threads that found but as I am not sure I will not loose data doing it myself (spoiled by PCLOS :D) I'd need some help.
----------------------------

I have a hard-disk under question of degrading. "Western Digital" 320 GB bought more than 5 years ago, may be 7.

PCLOS gradually stopped booting from it. If some program works with it the system may become utterly unresponsive (very slow on switching tasks), the HD-LED is "on" continiously, CPU and RAM are not heavily loaded. When I disconnect this drive by the cable *in-situ* the problem vanishes. Think I hear those "clicks of death" :o.

So I boot from other two PCLOS disks now, no problem.

There were 4 partitions on this disk, IIRC, created in this time order:
-sda1, NTFS 260 GB - data storage partition;
-sda2, extended ext4 partition - on the rest of the space; installed PCLOS in it so two more partitions
-sda5 - /
-sda6 - swap

I decided to delete all the partitions except the storage NTFS one and did it via PCC/Local disks/Manage disk partitions from a LiveCD. There is something wrong with this and below are some details.
As a last decision I can detach this disk and wait till the time I'll buy a new hard disk and transfer the data but this could be when the prices become  reasonable.

The details:

I can reach and see the files from the storage sda1 partition in file browser. It is filled with data and I share it on internetz.

GParted sees whole sda as unallocated.
Add: Big brown distro's alpha2 LiveDVD warns about too many bad sectors on the drive.

PCC/Local disks/Manage disk partitions at start says "the error is extended partition: bad magic number on disk sda".
It sees the bad partition but it's not manageable:


For such lamers like old-pollack, as etc. that never can do it via GUI :P ;) I post some CLI output of commands fdisk and fsck.
sda is the disk under question:

[root@thenudiebar Vortex]#

Code: [Select]
fdisk -l
Warning: invalid flag 0x0000 of partition table 5 will be corrected by w(rite)

Disk /dev/sda: 320.1 GB, 320071851520 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625140335 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x6e47a8ff

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *    85015980   625137344   270060682+   7  HPFS/NTFS
/dev/sda2              63    84999914    42499926    5  Extended

Partition table entries are not in disk order

Disk /dev/sdb: 320.1 GB, 320071851520 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625140335 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x177927fa

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          63    56372084    28186011   83  Linux
/dev/sdb2        56372085    86911649    15269782+   5  Extended
/dev/sdb3        86911650   625137344   269112847+   7  HPFS/NTFS
/dev/sdb5        56372148    83007854    13317853+  83  Linux
/dev/sdb6        83007918    86911649     1951866   82  Linux swap / Solaris

Disk /dev/sdc: 500.1 GB, 500106780160 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976771055 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xeb614b81

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *          63    43006004    21502971    7  HPFS/NTFS
/dev/sdc2        43006005   976768064   466881030    f  W95 Ext'd (LBA)
/dev/sdc5        43006068   976768064   466880998+   7  HPFS/NTFS

------------------------------------------------------


fsck /dev/sda2
fsck from util-linux-ng 2.18
e2fsck 1.42 (29-Nov-2011)
fsck.ext2: Attempt to read block from filesystem resulted in short read while trying to open /dev/sda2
Could this be a zero-length partition?

-----------------------------------------------------------


fsck -f /dev/sda2
fsck from util-linux-ng 2.18
e2fsck 1.42 (29-Nov-2011)
fsck.ext2: Attempt to read block from filesystem resulted in short read while trying to open /dev/sda2
Could this be a zero-length partition?

------------------------------------------------


fsck /dev/sda
fsck from util-linux-ng 2.18
e2fsck 1.42 (29-Nov-2011)
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/sda

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>

----------------------------------------------------

e2fsck /dev/sda2
e2fsck 1.42 (29-Nov-2011)
e2fsck: Attempt to read block from filesystem resulted in short read while trying to open /dev/sda2
Could this be a zero-length partition?


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

So how do you think - can I try to safely delete the bad sda2 partition without the danger of loosing the data partition sda1?

P.S. Now I'm running badblocks command.
« Last Edit: December 19, 2011, 12:48:18 PM by Vortеx »

Online Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 10606
  • MLUs Forever!
Re: Want to delete a bad partition, hard-disk may be dying
« Reply #1 on: December 17, 2011, 05:17:55 AM »
I would unplug that drive until I had a new one to copy the data to ........  any work on the drive is possibly going to kill it altogether.
If the data is valuable to you then it is imperative, IMO, that you grab it at the soonest opportunity.

So, IMO, do NOT do anything to the drive until you have your data safe - or at least as much of it as you can get.

regards
MLUs rule the roost!

Linux XPS 3.2.18-pclos2.pae.bfs  32 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT

Offline AS

  • Hero Member
  • *****
  • Posts: 4111
  • Have a nice ... night!
Re: Want to delete a bad partition, hard-disk may be dying
« Reply #2 on: December 17, 2011, 06:43:43 AM »
I would unplug that drive until I had a new one to copy the data to ........  any work on the drive is possibly going to kill it altogether.
If the data is valuable to you then it is imperative, IMO, that you grab it at the soonest opportunity.

So, IMO, do NOT do anything to the drive until you have your data safe - or at least as much of it as you can get.

regards

+100  ;)

Also note:
in case of I/O problems while reading disks, errors are always written in logfiles (dmesg, /var/log/syslog, /var/log/messages...)

I sware...
I read relative threads that found but as I am not sure I will not loose data doing it myself (spoiled by PCLOS :D) I'd need some help.
----------------------------

I have a hard-disk under question of degrading. "Western Digital" 320 GB bought more than 5 years ago, may be 7.

PCLOS gradually stopped booting from it. If some program works with it the system may become utterly unresponsive (very slow on switching tasks), the HD-LED is "on" continiously, CPU and RAM are not heavily loaded. When I disconnect this drive by the cable *in-situ* the problem vanishes. Think I hear those "clicks of death" :o.


I agree with your diagnosis, the disk is degrading ...

Quote

So I boot from other two PCLOS disks now, no problem.

There were 4 partitions on this disk, IIRC, created in this time order:
-sda1, NTFS 260 GB - data storage partition;
-sda2, extended ext4 partition - on the rest of the space; installed PCLOS in it so two more partitions
-sda5 - /
-sda6 - swap

I decided to delete all the partitions except the storage NTFS one and did it via PCC/Local disks/Manage disk partitions from a LiveCD. There is something wrong with this and below are some details.
As a last decision I can detach this disk and wait till the time I'll buy a new hard disk and transfer the data but this could be when the prices become  reasonable.


Your best choice IMO is to backup the NTFS partition if still possible, and ignore all the other partitions.

Quote

fsck /dev/sda
fsck from util-linux-ng 2.18
e2fsck 1.42 (29-Nov-2011)
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/sda


This is not a valid command, fsck can be used on partition, not on the whole disk.

Quote
So how do you think - can I try to safely delete the bad sda2 partition without the danger of loosing the data partition sda1?

As above, IMO, you best option is to backup /dev/sda1, as soon as possible, while still possible. (consider the use of dd_rescue ... to backup the partition)

Quote
P.S. Now I'm running badblocks command.

I think it's a bad idea, badblocks will stress your disk. Most (if not all) SATA drives actually implement automatic relocation of bad sectors, reallocating them to some spare sectors, up to fill the spare storage. When the spare storage is filled up completely it means your disk is already enough degraded. Note also that you start to see error related to bad sectors only when the spare storage is already filled up, it means that ii is already too late.

Finally, IMO, the best tools to monitor hard disk healt is S.M.A.R.T. technologies, it was explicitly designed to collect info about hard disk health, to prevent data loss.

see smartctl command, from smartmontools package, and gmartcontrol (GUI) if you are not a lamer  :P

AS

Online Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11521
  • ----IOFLU----
Re: Want to delete a bad partition, hard-disk may be dying
« Reply #3 on: December 17, 2011, 06:47:58 AM »
Vortеx:

You can't run an fsck on /dev/sda2 because it's an extended partition, which is only a container for logical partitions and as such has no filesystem of its own. The same applies to /dev/sda which is the entire drive, not a specific partition, and currently you have no ext2/3/4 formatted partitions to check, only the single NTFS partition.

Your partitions on /dev/sdb are as messed up as /dev/sda is. Whatever primary partitions you have, (those numbered 1-4) should be at the beginning of the drive, and whichever is designated as an extended partition should then extend to the end of the drive, and contain only logical partitions. (those numbered 5 and higher) On /dev/sda you have an extended partition at the beginning of the drive followed by a primary partition at the end of the drive. On /dev/sdb you have a primary partition followed by and extended partition, containing two logical partitions, followed by another primary partition. Effectively, you only have four filesystem bearing partitions, filling the whole drive, so they could just as well have all been primary partitions.
« Last Edit: December 17, 2011, 07:00:25 AM by old-polack »
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Vorteggs

  • Hero Member
  • *****
  • Posts: 2402
Re: Want to delete a bad partition, hard-disk may be dying
« Reply #4 on: December 17, 2011, 11:45:00 AM »
Well...

Great thanks, I'll try to rethink the things.

Thank you again friends. :)

Offline Vorteggs

  • Hero Member
  • *****
  • Posts: 2402
Re: Want to delete a bad partition, hard-disk may be dying
« Reply #5 on: December 19, 2011, 12:47:26 PM »
I detached that HD.

Thank you.  :)