Ubuntu – Low level format of hard drive

format

Can somebody please tell me how can I format a hard drive at a low enough level that the boot sector is re-written? I guess the equivalent of fdisk /mbr.

Best Answer

  • Edit: This answer is about ATA Secure Erase. llformat is just a (misleading) password.


    None of these answers is correct. A Low Level Format (LLF) is an instruction sent to the disk. To find out how to do this on Linux, read this hdparm tutorial on unix.stackexchange.com,

    This is a copy of the answer, current as of July 16, 2014 as provided by no.human.being et al,


    Under unixoid systems you can do it with "hdparm". You need to get "root" first, then do the following. This is assuming that the drive you want to low-level format is "/dev/sda" and that you have "hdparm" installed.

    hdparm -I /dev/sda
    

    The parameter is a capital "i", not a lowercase "l", just in case the font is ambiguous. If the drive shows "frozen" you must first "un-freeze" it. What you need to do to "un-freeze" it depends on the device. Most devices will "un-freeze" if you put the system to "suspend to RAM" mode, then wake it up again. If the device shows "not frozen", you can proceed.

    hdparm --user-master u --security-set-pass llformat /dev/sda
    

    Then show the device info again with the capital "i" as parameter.

    hdparm -I /dev/sda
    

    It should now display "enabled" under "Security:". This is quite a critical step. The device is now secured. If you power it down, it will lock and might become inaccessible. When you perform the low-level format NOW, security will be disabled again and you can continue using the device.

    hdparm --user-master u --security-erase llformat /dev/sda
    

    The device should now be physically wiped.

    hdparm -I /dev/sda
    

    Once more with the capital "i". Confirm that security has returned to "not enabled". You can now partition and format the device.

  • Related Question