LINUX.ORG.RU

опция noerror,sync и большие блоки bs=4M

 


0

2

Что если я копирую с диска с битыми секторами и указал по привычке bs=4M и оно уже много часов успешно копирует. Встречаются плохие сектора и пишет I/O error и продолжает. Так что там нулями забьется? Только 512 байт или прям все 4M?

Увы...

Cloning an entire hard disk

From physical disk /dev/sdX to physical disk /dev/sdY

# dd if=/dev/sdX of=/dev/sdY bs=512 conv=noerror,sync

This will clone the entire drive, including the MBR (and therefore bootloader), all partitions, UUIDs, and data.

noerror instructs dd to continue operation, ignoring all read errors. Default behavior for dd is to halt at any error. sync fills input blocks with zeroes if there were any read errors, so data offsets stay in sync. bs=512 sets the block size to 512 bytes, the «classic» block size for hard drives. If and only if your hard drives have a 4 Kib block size, you may use «4096» instead of «512». Also, please read the warning below, because there is more to this than just «block sizes» -it also influences how read errors propagate.

Warning: The block size you specify influences how read errors are handled. Read below.

The dd utility technically has an «input block size» (IBS) and an «output block size» (OBS). When you set bs, you effectively set both IBS and OBS. Normally, if your block size is, say, 1 Mib, dd will read 1024*1024 bytes and write as many bytes. But if a read error occurs, things will go wrong. Many people seem to think that dd will «fill up read errors with zeroes» if you use the noerror,sync options, but this is not what happens. dd will, according to documentation, fill up the OBS to IBS size after completing its read, which means adding zeroes at the end of the block. This means, for a disk, that effectively the whole 1 Mib would become messed up because of a single 512 byte read error in the beginning of the read: 12ERROR89 would become 128900000 instead of 120000089.

If you are positive that your disk does not contain any errors, you could proceed using a larger block size, which will increase the speed of your copying several fold. For example, changing bs from 512 to 64 Ki changed copying speed from 35 MB/s to 120 MB/s on a simple Celeron 2.7 GHz system. But keep in mind that read errors on the source disk will end up as block errors on the destination disk, i.e. a single 512-byte read error will mess up the whole 64 Kib output block.

Жаль...

I-Love-Microsoft ★★★★★
() автор топика
Ответ на: комментарий от anonymous

какой ты молодец, всем продемонстрировал что умеешь открыть ман

Да загуглить не выходило, а запостил - потом нашлось. Это не ман, это где-то в арч-вики нашел кажись...

I-Love-Microsoft ★★★★★
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.