Linux low level formatting

How to do a low-level format

I have a hard disk which has some bad sectors on it. And it said when I booted in Linux mint that I already need to replace the hard disk. But I don’t have yet the money. I’m just a student. How do I do a low level format? What do I need to do before trying to do it?Is there a particular time span until all of the hard disk breaks down and lose all of my data wen it has already bad sectors on it? How long will a low-level format take, for a laptop with 2Ghz core 2 duo processor and 2Gb ram.

5 Answers 5

The terminology «Low Level Format» as used by MHDD32 and everyone here is incorrect. MHDD32 uses this term to refer to issuing an «erase» command to every sector on the hard drive. This is NOT what a true «Low Level Format» is. Writing to every sector will force the drive’s firmware to indeed «recalculate ECC» and also remap bad sectors into spare sectors (if it has any left) — so this is useful for repairing drives with bad sectors (although the disk should really be replaced soon).

A low-level format is a process where the drive writes things like sync marks and sector markers to the disk, which would only not be present if the disk is basically a fresh unmagnetized platter from the factory. A disk that has not been nor ever been truly low-level formatted will therefore be physically unreadable. Writing all zeros to all sectors, or any sectors, requires the basic «framework» signaling be written on the disk for the drive controller to be able to find specific sectors.

There was a time in the early to mid 80’s before Windows dominance where floppy disks were typically sold «unformatted» — and this low-level format had to be performed for the disk to be useable. The old DOS FORMAT command did the low-level format automatically unless you used the /Q switch for a «quick format» — which was not possible on a never-formatted disk. Linux has separate commands for the low-level ( fdformat ) and high-level ( mke2fs , etc.) format.

The old MFM and RLL hard drives were the same way, but they typically came pre-low-level-formatted from the factory (complete with a sticker listing known defective sectors). But you could perform a true low-level format — one way was to call the low-level format in the controller’s ROM directly using the old DOS DEBUG command (http://discussions.virtualdr.com/archive/index.php/t-69312.html). Also read this: http://www.redhill.net.au/d/10.php

IDE drives did not typically provide a user accessible low-level format routine or command and therefore it’s not possible to do a true low-level format on these types of drives. You never know what types of diagnostic or debug commands are available on a drive, and what the code on the firmware is capable of doing, but that is the only way a true low-level format would be possible on modern drives.

Читайте также:  Создание потоков в линуксе

Источник

How can I low-level format flash memory in Linux?

My friend was having problems with a USB flash drive, and I suggested he do a low-level format. Then it occurred to me that I don’t even know how to do that in Linux. So. how can I low-level format flash memory in Linux? My friend tried a «full format» on the drive in Windows and it failed.

7 Answers 7

«Low level formatting» was done on floppies, where you could write at different densities by choosing to organize the tracks and sectors differently. But this makes no sense for most modern media. Its notion of how to organize the data on the device is fixed and unchangeable. It doesn’t make any sense at all for flash, which has discrete bits, rather than magnetic domains. Higher level formatting is possible, which is mkfs in unix-land.

So if the filesystem on my friend’s flash drive is messed up, mkfs is his only option? What if that doesn’t work? There’s nothing else he can try?

I test tons of flash USB memory at work and the quality of that is all over the map, so I wouldn’t be surprised if your friend’s drive is just broken and can’t work anymore. These things can break in many different ways and there’s not much you can do about it, other than buying memory from reputable sources and then maybe testing it with f3 to make sure it’s not broken.

There is no way to do a low-level format on most flash devices, since they have an additional translation layer from USB/ATA/SD/etc. to MTD which obscures the low-level MTD devices (which can be low-level formatted if gotten to directly [which you can’t]).

Low-level formatting means many different things to different people and on different contexts.

The original meaning was a step needed in the formatting of disks — disk drives need header, sync and other patterns written on the media before it can store data to it. In this way the head can detect when it is A) on a track and B) where it is on the track. Low-level formatting a floppy prepares the disk to be able to read and write blocks. Early MFM and RLL PC hard drives could be low-level formatted, often using a utility built into the hard drive controller’s (an ISA card) ROM. Modern IDE and SATA hard drives are low-level formatted too, but only at the factory.

Various other meanings include writing zeros to all blocks, configuring the drive to disable «hidden» areas such as HPA and DCO and then zeroing all blocks, or other things more related to partitioning than formatting.

Raw flash needs a different initial preparatory step at the factory — each flash «eraseblock» (analogus to a «block» on disks) needs to be tested and marked as bad if it is indeed bad. Each «eraseblock» has an additional small «OOB» block that holds error correcting information — and this is where it is marked as bad. You do NOT want to repeat this step as the act of writing to a bad block could prevent you from setting that particular bit again that identifies it as bad.

Читайте также:  Linux ssd trim all

But you are not dealing with raw flash. You are dealing with a USB flash drive. There is a controller chip in all flash drives that accepts USB commands from the host and talks to the raw flash inside on the host’s behalf. Some of these controller chips can be configured to report part of the flash as a separate CD-ROM partition, or act like two separate USB storage devices. Depending on the make and model of the controller chip, you may be able to find a recovery or configuration utility (likely Windows only) that could reset this controller chip. You would begin by opening the flash drive, looking for the smaller of (likely) two chips that are on the small PCB, and doing some Googling. The make and model printed on the outside of the case is not likely to help you find who made the controller inside of it.

Источник

Низкоуровневое форматирование диска в Linux?

Всем здравствуйте! Для низкоуровневого форматирования есть программа на WIndows HDD Lewel Format Tool.
Я прочитал в интернете что на Linux для низкоуровневого форматирования можно использовать команду dd if=/dev/zero of=/dev/sdX.
Ещё есть команда dd if=/dev/null of=/dev/sdX.
Дело в том что я хочу подготовить диск к продаже + на нём имеются программные бэд блоки.
С помощью низкоуровневого форматирования можно стереть все данные и даже починить некоторые бэд блоки.

Я не понял, какая разница между zero и null?

Простой 1 комментарий

xotkot

Низкоуровневое форматирование — это нужны утилиты от производителя, у каждого свои.
ssd диск можно ‘отформатировать’ запустив команду trim на весь диск (утилита blkdiscard)

Вторая команда неправильная, /dev/zero возвращает бесконечные нули, а /dev/null нельзя читать, только бесконечно что угодно в него записывать

Чтобы подготовить диск к продаже, dd if=/dev/zero of=/dev/sdX. более чем достаточно.
С бэдами ничего не сделаешь, они будут видны в отчетах смарт (причем еще до их появления), такой диск только на свалку/запчасти ремонтникам (продавайте на авито, могут купить как донор, приложив скрин SMART).

hint000

Небольшая неточность, читать /dev/null можно, но в контексте данного вопроса бессмысленно — будет сразу EOF, но если копировать из /dev/null в файл, то получится файл размером 0 байт (что иногда бывает полезно).

$ ls -l -rw------- 1 user user 100500 Feb 5 10:59 1.txt $ cat /dev/null > 1.txt $ ls -l -rw------- 1 user user 0 Feb 5 11:00 1.txt

Saboteur, если точнее, то это результат перенаправления потока вывода в файл оператором >, т.е. неважно как отработает cat, вывод все равно будет записан в файл. С другой стороны, если взять dd и писать напрямую, а не через потоки ввода/вывода, то результат будет таким же. Т.к. по документации: Reads from /dev/null always return end of file.

Читайте также:  Suse linux enterprise server настройка сети

zero — это ноль;
null — это отсутствие значения.

/dev/zero при чтении генерит поток нулей, при записи игнорирует все что в него попадает.
/dev/null при чтении отправляет конец файла, при записи игнорирует все что в него попадает.

Jump

Его делают исключительно на заводе, в домашних условиях его сделать невозможно без покупки специализированного оборудования.
Низкоуровневое форматирование это запись сервометок на пластине.
Высокоуровневое или обычное это просто создание операционной системы, т.е запись нескольких файлов.

Я прочитал в интернете что на Linux для низкоуровневого форматирования можно использовать команду dd if=/dev/zero of=/dev/sdX.

А я прочитал на заборе слово из трех букв.
Команда DD это команда копирования данных, к форматированию вообще никаким боком отношения не имеет.

Программные бэд блоки это блоки помеченные операционной системой.
Если удалите ОС — удалятся и пометки.

SidoroV11

Ошибся немного. Не низкоуровневое форматирование. Команда удаляет все разделы и mbr и перезаписывает диск нулями. Гарантирует что восстановить данные невозможно. А разделы с файловой системой уже создаёшь сам.
Просто назвали так низкоуровневое форматирование.

leahch

Бед-блоки таким форматирование не исправить! Можно исправить утилитами производителя диска, но лучше вообще этого не делать.
Записывать нужно zero — это нули, а null — пустота, ничего не запишет.

msHack

это не низкоуровневое форматирование, это заполнение диска нулями.

разницы между /dev/null и /dev/zero нет.
оба потока при чтении отдают неограниченный поток нулей.
да и при записи ведут себя идентично — все записанное удаляется.

SidoroV11

И то и другое не имеют отношения к низкоуровнему форматированию
Беды не исправить их диск сам должен релоцировать на запасные места
А так достаточно сделать полное долгое форматирование в Винде(убрать галочку быстрое) и этого достаточно перед продажей

SidoroV11

У меня нет компьютера с Windows. Сказали что /dev/zero это низкоуровневое форматирование потому что сотрёт все разделы и mbr и перезапишет диск нулями. Данные никак не возможно будет восстановить

Афанасий Сидоров, низкоуровневое форматирование это разметка геометрии хранения данных для магнитных дисков. Т.е. расстояние между дорожками и плотность данных на них. К примеру, раньше, низкоуровневым форматированием можно было увеличить объем данных на гибком диске в 2,2 раза от стандартного.
Современные жесткие диски проходят низкоуровневое форматирование 1 раз на заводе-изготовителе, в повторных форматированиях нет смысла.
То, о чем вы пишите, это просто заполнение нулями каждого сектора диска. При обычном форматировании раздела просто устанавливается тип раздела, подготавливается загрузочная область раздела и формируется нужная структура под тип, по-сути записывается всего несколько секторов обычно в начало раздела. Таким образом большая часть раздела просто помечена свободной, но не очищена, и остатки данных оттуда можно изъять, поэтому если не хочется, чтобы кто-то вашу информацию нашел, лучше перед продажей заполнить нулями весь диск.
Повторюсь, это не низкоуровневое форматирование, т.к. на геометрию хранения данных оно никак не влияет.

Источник

Оцените статью
Adblock
detector