Formatting hard drive failed

72,899

Solution 1

Before you can make a file system you have to create a partition.

  • sudo fdisk /dev/sdX
    Where "X" is the drive letter (like sda or sdb depending on the drive).

  • n => Create new Partition (Then create what you need)

  • t => Specify type (NTFS is 07 I think, but you can take a look at the list with L)

  • w => Write the changes to disk and exit

Now you can make your file system with sudo mkfs.ntfs /dev/sdX1where "x" is the drive letter from above. Add the configuration paramaters you need.

Solution 2

I was having trouble with a bootable usb drive that I had installed YUMI on. It would only mount as read-only. I decided to trash all the data on the usb drive and start over. If you have data that you want to keep from your usb drive, BACK IT UP first.

First I tried using the Ubuntu "Disks" gui utility that is available with Ubuntu 12.10. I was getting the same error when trying to format the usb drive, "udisks-error-quark, 0". Turns out the usb drive needs to be repartitioned, not just reformatted. I was able to successfully resolve the issue (using gui only) by doing the following:

Install gparted from the Ubuntu Software Center & run. gparted first showed me the partitions on my hard drive, /dev/sda. To show my usb drive, in the menu, I went to

Gparted -> devices -> /dev/sdc (could be /dev/sdb or another depending on how many devices you have plugged in, if you have multiple hard drives, or other usb drives or an iphone mounted the last letter will be different. You need to be sure that you know what the device name is of the usb drive that you want to partition or you'll erase something unintentionally)

when I did that, it showed my usb drive's partition, in my case being 3.73 GB and having only 1 partition, versus my hard drive being device /dev/sda with 74.53 GB and having 3 partitions labelled "ext4", "extended", and "linux-swap".

After I had my usb drive selected, I right-clicked in the partition area of Gparted and selected "delete" and the partition area turned grey and was marked "unallocated". I right-clicked again in the grey area and selected "New". I allowed the default maximum size and changed the default filesystem type from "ext2" to "fat32" and I entered a label name for the new partition on my usb drive.

(You could also use an ntfs filesystem. To decide which filesystem to use on your usb drive, google ntfs fat32 usb drive. Read some forum posts that come up in the results. There are advantages and disadvantes to each, whether it is playing nice with windows or a mac, or loading large media files.)

Then I verified one more time that I had my usb drive selected to perform the partition operation and not my hard drive or some other device! The device selector on the top right hand side of the gparted window showed /dev/sdc. Yours may be different.

Then I clicked the green check mark at the top of the gparted window that will "Apply All Operations"

If everything goes well, you'll get a popup saying that all operations were performed successfully. If you get a message about the device being used by another program, then "eject" the drive by right clicking on it's icon in the unity task bar and selecting "eject". Then remove and reinsert the usb drive. On gparted menu go to Gparted -> Refresh Devices and you should be able to select the usb drive again. You may have to tell it that you want to create a new partition again with the options you inputted before. Then try clicking the green check mark button again to partition.

Once it has been partitioned, try using your file manager to copy a file to it and see if it works. Should be fine! No need to use the Disk tool to format.

Share:
72,899

Related videos on Youtube

Gabi Barrientos
Author by

Gabi Barrientos

Updated on September 18, 2022

Comments

  • Gabi Barrientos
    Gabi Barrientos over 1 year

    I am fairly new to ubuntu, so please don bite my head off if I ask a stupid question.

    Anyway, I tried formatting one of my hard drives using the gnome disks tool, and that returned an error.

    Error creating file system: Command-line `mkntfs -f -F -L "New Volume" "/dev/sdb"' exited with non-zero exit status 1:
    stdout: `Cluster size has been automatically set to 4096 bytes.
    Creating NTFS volume structures.
    '
    stderr: `/dev/sdb is entire device, not just one partition.
    mkntfs forced anyway.
    Error writing to /dev/sdb: Input/output error
    Error writing non-resident attribute value.
    add_attr_sd failed: Input/output error
    Couldn't create root directory: Input/output error
    Failed to fsync device /dev/sdb: Input/output error
    Warning: Could not close /dev/sdb: Input/output error
    ' (udisks-error-quark, 0)
    

    I have no idea what this error means, and how I should format my hard drive (IF I am still able to). Does this mean that my hard drive is fried and that I can just throw it out, or can I still save it?

    EDIT:

    Using sudo fdisk -l returns the following output:

    Disk /dev/sda: 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: 0x00084eb8
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *        2048      499711      248832   83  Linux
    /dev/sda2          501758   312580095   156039169    5  Extended
    /dev/sda5          501760   312580095   156039168   8e  Linux LVM
    
    Disk /dev/sdc: 82.0 GB, 81964302336 bytes
    255 heads, 63 sectors/track, 9964 cylinders, total 160086528 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: 0xd30c01f2
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1            2048   160083967    80040960    7  HPFS/NTFS/exFAT
    
    Disk /dev/mapper/ubuntu-root: 237.4 GB, 237447938048 bytes
    255 heads, 63 sectors/track, 28868 cylinders, total 463765504 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: 0x00000000
    
    Disk /dev/mapper/ubuntu-root doesn't contain a valid partition table
    
    Disk /dev/mapper/ubuntu-swap_1: 4294 MB, 4294967296 bytes
    255 heads, 63 sectors/track, 522 cylinders, total 8388608 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: 0x00000000
    
    Disk /dev/mapper/ubuntu-swap_1 doesn't contain a valid partition table
    

    But this does not contain the hard drive I am trying to format, as it seems. The other two devices that show up (/dev/sda and /dev/sdc) are the ones I have combined into one logical view. The third one, or I should say the second one (/dev/sdb) never shows up in this list, but only shows up in the gnome disks utility. Formatting it from the command line, as well as formatting it from the utillity returns the same result.

    EDIT 2:

    Using sudo parted -l returned the following:

        Model: ATA MAXTOR STM316021 (scsi)
    Disk /dev/sda: 160GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    
    Number  Start   End    Size   Type      File system  Flags
     1      1049kB  256MB  255MB  primary   ext2         boot
     2      257MB   160GB  160GB  extended
     5      257MB   160GB  160GB  logical                lvm
    
    
    Error: /dev/sdb: unrecognised disk label                                  
    
    Model: ATA Maxtor 6Y080L0 (scsi)
    Disk /dev/sdc: 82.0GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    
    Number  Start   End     Size    Type     File system  Flags
     1      1049kB  82.0GB  82.0GB  primary
    
    
    Model: Linux device-mapper (linear) (dm)
    Disk /dev/mapper/ubuntu-root: 237GB
    Sector size (logical/physical): 512B/512B
    Partition Table: loop
    
    Number  Start  End    Size   File system  Flags
     1      0.00B  237GB  237GB  ext4
    
    
    Model: Linux device-mapper (linear) (dm)
    Disk /dev/mapper/ubuntu-swap_1: 4295MB
    Sector size (logical/physical): 512B/512B
    Partition Table: loop
    
    Number  Start  End     Size    File system     Flags
     1      0.00B  4295MB  4295MB  linux-swap(v1)
    

    As shows, my /dev/sdb device is unrecognized (Error: /dev/sdb: unrecognised disk label). This should bring me a bit closer to the solution, if only I knew what to do with this.

    EDIT 3:

    After some further research, it turns out that my hard drive doesn have a partition table, and I can't create one on the device, because my computer detects it as if it were a zero-length partition.

    I'll have to cut my losses and just accept the fact that it's dead. Thanks anyway for being helpful.

  • Gabi Barrientos
    Gabi Barrientos about 11 years
    Assuming that I would need to use fdisk /dev/sdb instead of fdisk /dev/sdbX (because that returned fdisk: unable to open /dev/sdbX), I received another error: fdisk: unable to read /dev/sdb: Input/output error.
  • Arammil
    Arammil about 11 years
    Also a noob, but from the reading I've been doing about some boot issues I've had this information may help: Ubuntu names its drives with letters, i.e. /dev/sda is one /dev/sdb is another. It also numbers the partitions on the drives, i.e. /dev/sda1 and /dev/sda2 means that drive 'a' has a partition labeled as 1 (sda1) and another partition labeled as 2 (sda2). fdisk /dev/sdb1 or fdisk /dev/sdb2 and so on.
  • prophecy201
    prophecy201 about 11 years
    Sorry, I edited the post. In your case use sudo fdisk /dev/sdb. After this process you will have a partition /dev/sdb1. sdb is the device an 1 is the partition as Arammil said.
  • Gabi Barrientos
    Gabi Barrientos about 11 years
    using sudo fdisk /dev/sdb gives me fdisk: unable to read /dev/sdb: Input/output error. I keep bumping into that error with everything I try.
  • Arammil
    Arammil about 11 years
    Are you sure the drive you're reformatting is "b"... can you check to make sure it isn't say.. sdc or sde or some other drive letter?
  • prophecy201
    prophecy201 about 11 years
    Does sudo fdisk -l shows you the device /dev/sdb? Please edit your post with the output.
  • Gabi Barrientos
    Gabi Barrientos about 11 years
    I edited my post. However this might turn out, I really appreciate the effort you guys put into tying to help me out.
  • Arammil
    Arammil about 11 years
    I shall query the google demon and see what results it brings to me. Also which ubuntu are you using, 12.04?
  • Gabi Barrientos
    Gabi Barrientos about 11 years
    I'm using 12.10 LTS. I also tried summoning the google demon in order for it to unleash it's all-knowing prophecy upon me, but that didn't really give me anything I could work with. And yes, it's an internal device.
  • Arammil
    Arammil about 11 years
    I think I have a lead.. though no solutions yet... [link]ubuntuforums.org/showthread.php?t=2029978 This gave me the first hint.. I think your 'b' drive isn't partitioned correctly.. which is kind of the problem to begin with.. will continue researching though.
  • Gabi Barrientos
    Gabi Barrientos about 11 years
    Updated my post with the results of sudo parted -l
  • Arammil
    Arammil about 11 years
    Yeah, I'll be fair, this is definitively beyond my knowledge to help you with, but two things: the data on your b drive is probably gone forever (hope it wasn't important but probably wasn't b/c you're reformttign). Secondly, I'd look at how to rename/repartition B such that it is recognized.. that link I provided goes on a bit about that. its 6Am and I'm passing out. Good luck.
  • Gabi Barrientos
    Gabi Barrientos about 11 years
    Thanks for your help. I'll go on researching for a bit, but if it turns out to be a waste of time, I'll yank it out of my computer and feed it to the toilet.
  • Lital Kaminsky
    Lital Kaminsky over 10 years
    hi @GabiBarrientos have you repaired your drive ? I'm having the same problem for my sandisk cruzer blade. Whatever I try to do it is showing Input/Output error. I tried both in Ubuntu and Windows. If you have solved the problem please let me know.
  • Gabi Barrientos
    Gabi Barrientos over 10 years
    @learner Well, I ended up using Killdisk from Hiren's Bootdisk to write the disk to 0, but that only lasted for a week until it died for good. You could try that, but I wouldn't get my hopes up that it will work, or if it does, that it will work for a long time.
  • IgorGanapolsky
    IgorGanapolsky over 7 years
    This is a very long answer. What commands specifically did you execute?