1

I have a couple old ATA (yes, not SATA) hard drive around with USB enclosures. One of them gave me some EXT4 journal error, so I am not sure whether they have a physical problem. Since they are just backup disks, I want to put a new btrfs onto them.

fdisk

I tried to do this with fdisk. To clean them completely, I want a new partition table, in case there was a problem in there.

env LC_ALL=C sudo fdisk /dev/sdc

This is the current state of one of the disk:

Command (m for help): p

Disk /dev/sdc: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 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: 0x00006dd0

   Device Boot      Start         End      Blocks   Id  System

Then I create a new partition table:

Command (m for help): o
Building a new DOS disklabel with disk identifier 0x20bf4f51.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

This warning comes every time with every disk. The value of the flag might differ, though. Now I print the partition table again:

Command (m for help): p

Disk /dev/sdc: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 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: 0x20bf4f51

   Device Boot      Start         End      Blocks   Id  System

That is still empty, fine.

Create a new partition:

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): 
Using default response p
Partition number (1-4, default 1): 
Using default value 1
First sector (2048-312581807, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-312581807, default 312581807): 
Using default value 312581807

There should now be a partition that spans the whole disk. When I check with p again, there is a partition.

Write it:

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

Error closing file

I am a little clueless on this. I used dd to write 400M of zeros onto the first part of the disks, but that did not change anything.

KDE Partition Manager

This is the original state of the disk:

Now I want to create a new partition table:

Create a new partition in the unallocated area:

Write changes to disk:

Unhelpful error message:


I am a little stuck here, I have no idea why I cannot just reformat the disks to my liking.

I use Ubuntu 14.04.

  • Looking at this, you did quite everything you could. I would suspect hardware failure. I would suggest to try badblocks or some other tool to check the disk health, also try to read the SMART data using smartctl or something else. – user84867 Sep 21 '14 at 13:43
  • I was able to format the harddrive with Windows 8, though. And after I changed it to GPT there, I was able to format it again with gdisk. – Martin Ueding Sep 21 '14 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.