TransWikia.com

Unable to format disk: Invalid argument

Ask Ubuntu Asked on February 23, 2021

I am trying to format an external hard disk in Ubuntu 18.04 following the description given here. However, after having deleted all partitions in fdisk and created a new one, and entered w to write it to disk, I get the following output:

Command (m for help): w
The partition table has been altered.
Failed to remove partition 1 from system: Invalid argument
Failed to remove partition 2 from system: Invalid argument
Failed to remove partition 3 from system: Invalid argument
Failed to remove partition 4 from system: Invalid argument
Failed to add partition 1 to system: Invalid argument

The kernel still uses the old partitions. The new table will be used at the next reboot. 

/dev/sdc1: close device failed: Input/output error

The disk is potentially damaged! How to figure out if there is a way to format (part) of the disk, or if the disk is really damaged beyond any use? (I am able to access MOST of the content on the disk, so the disk cannot be that damaged. But I am unable to repair/reformat it).

So what can I do?

2 Answers

To be able to answer this question, one would have to see how you went about making your changes including how fdisk was invoked. With fdisk, you can follow your progress by using the 'p' (print) command to view the partition table, use it to see if your commands to delete partitions and create new (command 'n') partitions actually did what you thought it should. You can create a completely new partition table with the 'o' command (for a DOS type of table). Use the command 'v' to verify the table, if there are no errors, you should be able to write it out to the disk.

Keep in mind, only a partition can be 'formatted'. What is your reason to redo the partition tables and format the disk? Are you getting read/write errors with this disk? If that is the case, you should replace the disk, it won't get better.

Sorry to go on here, but I went and looked at the your source of information.

Ahh! I just looked at the directions for using fdisk, that you refered to, it leaves out an important step, choosing the type of partition that you want, using the 't' command to change (set) the partition type. Use 83 for a "normal" linux partition, use 82 for a linux swap partition. Use the 'l' command to list the values for different OS's. You may also want to toggle whether the disk is bootable or not, using the 'a' command. Hope this helps!

Answered by Bruce Lytle on February 23, 2021

By the looks of it you have successfully created a new partition table. The errors point to the aftermath jobs of closing the device. Since you have deleted previous partitions it cannot remove partition 1,2,3,4 because they don't exist anymore. And likewise cannot load the new table as removal of old ones failed. You should just reboot and start formatting it.

Answered by anjanik012 on February 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP