Format a hard drive or US at low level

Low level format

I was talking to you recently about how to format USB from terminal without assistance from any program, also within this topic I would like to add the how to low level format a device of storage. 

El low-level format in a nutshell is to leave some device as new, I do not mean that it will be restored and started again when they first acquired it, but with the passage of time the data written on the storage devices will be rewritten. 

When I talk about being rewritten, it is that, when we format a device, our data is not completely erased, only some sectors are eliminated and not all, in this way it is possible to recover some data as well. 

For data protection maniacs, this method is something they should commonly use as what we are going to do is rewrite all sectors of our device to 0. 

Although it is something that is considered obsolete, it is still a great function that helps us in the most extreme cases, for example when our computer does not recognize a device, this is where this function also comes into play. 

The first thing is that we must identify in which mounting point we have our device on which we will give it a low-level format. 

We can find this out with: 

lsblk 

Now from this point I am not responsible because you must be completely sure on which device you are going to work, if you have more than one connected I recommend you only leave the device you are going to work on connected, 

First execute the command without having connected the device and then execute it, but with the device connected, in this way you will find out which was the mount point that was added. 

In this case we must discard our hard drive, within the list that the command displays, in my case I have: 

/dev/sda1
/dev/sda2

/dev/sda3

/dev/sda4

/dev/sdb1

/dev/sdb2

/dev/sdc 

In my case I have 2 hard drives connected, which in your case are / dev / sda with its four partitions of my system / boot / home / root / swap and in the case of / dev / sdb there are two partitions where I have my personal data . 

This way I know what / dev / sdc is my device on which I will give it a low level format. 

Now i just have to run the following command in terminal with super user permissions: 

dd if=/dev/zero of=/dev/sdX

Where / dev / sdX will be the mount point that I will format. 

In my case the command would be like this: 

dd if=/dev/zero of=/dev/sdc

Now we will only have to wait a while since this type of format takes a little time. 

Finally, the device will not have a format so we must give it to it, in my case I will give it a fat32 format 

sudo mkfs.vfat -F 32 /dev/sdc -I

 

And that's it. 

 


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Mark Slim said

    What is it : ?

  2.   Julio Cesar Campos said

    Thanks for the article of general interest, I use the shred command, and it works very well. What I do is that sometimes when I want to reinstall a linux OS, I delete the partition, and create a new one of variable size sometimes 15 or 20 G, I format it with ext4 and then I apply the above command to it.
    sudo shred -vu / dev / sda? (The interrogation is for the # of the partition) what it does is give 3 passes to the hard disk, as I understand the third one fills the sectors with zeros and the others are erasing the existing files.

  3.   Julio Cesar Campos said

    I forgot, then I resize the wall to the original size and install the linux OS on it.

  4.   Mr Horse said

    / dev / sda1 is not a mount point. It is a device. Come on, what if we do a:

    mount / dev / sda1 / mnt

    / dev / sda1 is partition 1 of disk A and you MOUNT it on MOUNT POINT / mnt.

    Greetings,
    Mr Horse

  5.   Incognito horse said

    Some text has crept in between the ads.

    A cordial greeting,

    His indomitable steed.

  6.   J said

    Greetings.

    The dd command is used to clone disks: if = source disk of = destination disk and with that you do not format at a low level.

  7.   Sara said

    Hi, I have two partitions on my hard drive, one for windows 10 (it came from the factory) and one for Debian Jessie. Note: since the partition was made, Windows 10 does not start.

    Now I wanted to format my hard drive so that it returns to the factory data and without partitions, that is, to Windows 10 in its entirety. And later split it to have Debian 9 / Windows 10 being able to use both (xd).

    The thing is, I don't know how to format my computer from Debian Jessie to get to the first point. If you could give me a cable with this or how to tell me how I can adapt the info in this article to my case ... !!! Thank you.

    If I put the lsblk command I get the following:

    NAME MAJ: MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8: 0 0 465,8G 0 disk
    ├─sda1 8: 1 0 600M 0 part
    ├─sda2 8: 2 0 300M 0 part
    ├─sda3 8: 3 0 128M 0 part
    ├─sda4 8: 4 0 282,1G 0 part
    ├─sda5 8: 5 0 15,9G 0 part
    ├─sda6 8: 6 0 1M 0 part
    ├─sda7 8: 7 0 160G 0 part /
    └─sda8 8: 8 0 6,8G 0 part [SWAP]
    sr0 11: 0 1 1024M 0 rom

  8.   oriel said

    try to do it for a write protected pen drive and it doesn't work, any ideas?