3

Due to malware that overwrote the boot sector, I had to low-level format my disk using hdparm.

I am trying to reformat the disk now (have more than one) but gparted gives me an i/o error. One disk that was not low-level formatted was encrypted.

How can I format the drives (via CLI if necessary)? I am connecting the drive through USB and it is connected to the kernel.

Dave
  • 31
  • 1
    Try to wipe the first mibibyte with mkusb and after that use gparted to create a partition table and after that create partitions. If this does not work, you should try again with hdparm. Maybe you did not create a correct low level format. Maybe there is some serious damage (for example physical damage), that makes the drive fail. See this link about mkusb, https://help.ubuntu.com/community/mkusb . You can also check the S.M.A.R.T. information about the drive's health status for example via Disks alias gnome-disks. – sudodus Aug 20 '17 at 12:48
  • 1
    Could you please add a little more detail? What exactly did you do, what did you want to achieve and what happened instead? Did you encounter any warning or error messages? Please reproduce them in their entirety in your question. You can select, copy and paste terminal content and most dialogue messages in Ubuntu. (see How do I ask a good question?) – David Foerster Aug 22 '17 at 11:10

1 Answers1

3

Wipe the boot sector

If you suspect that the boot sector is infected with malware, you can use hdparm but need not use such a basic or powerful tool. The boot sector is available via 'regular' tools, that can write to a mass storage device, for example dd or Disks alias gnome-disks, or mkusb.

hdparm and dd are powerful but risky tools. Disks and mkusb provide safer conditions because they help you identify the target drive and double check, that you are wiping the correct drive (and not a drive, where you have important data).

It is enough to wipe the first few bytes, but wiping the first mibibyte will be enough for this purpose as well as removing other data that might disturb or confuse the function of partitioning tools like gparted. There is a menu entry for this task in mkusb. You may want to wipe the whole drive (if you suspect that there is other malware somewhere in the drive), and there is also a menu entry for that task.

enter image description here

Low level wiping

Maybe you did not create a correct low level format with hdparm. You can try again, for example according to the instructions in the following link,

Re: best way to wipe a drive

It is probably easier to succeed with DBAN, that you can find via the following link,

dban.org/

It works well enough for this purpose with the free version.

Maybe the disk hardware is damaged

Maybe there is some serious damage (for example physical damage), that makes the drive fail. See this link (some of the tips but not all of them are relevant for hard disk drives),

Can't format my usb drive ... Analysis of the problem

It is a good idea to check the S.M.A.R.T. information about the drive's health status for example via Disks alias gnome-disks. Select S.M.A.R.T. via the button at (1) and check the overall assessment at (2).

enter image description here

karel
  • 114,770
sudodus
  • 46,324
  • 5
  • 88
  • 152