Welcher Weg ist der schnellste Weg, um die letzten 512 Kilobyte der Festplatte zu "dd"

8837
teerapap

Ich habe eine 512-G-Festplatte und möchte die letzten 512 KB am Ende der Festplatte löschen.

Ich lösche es normalerweise von dd if=/dev/zero of=/dev/da0 der ganzen Platte.

Welcher Weg ist der schnellste, um diese Operation durchzuführen?

6

2 Antworten auf die Frage

7
ddiepo

As already pointed out, dd accepts the seek=BLOCKS parameter, which skips BLOCKS blocks in the output file.

Now you need to know the exact size of the disk, if you want to write the last 512kB. On linux, you can use the blockdev --getsz DEVICE command to get the size, in units of 512B.

So the command-line becomes something like:

dd if=/dev/zero of=$YOUR_DEV bs=512 seek=$(( $(blockdev --getsz $YOUR_DEV) - 1 )) count=1 
Diese akzeptierte (?) Antwort löscht die letzten 512 Bytes der Datei, während die Frage etwa 512 Kilobyte betrug, was ziemlich viel größer ist. Der Befehl sollte lauten: `dd if = / dev / zero von = $ YOUR_DEV bs = 512 seek = $ (($ (blockdev --getsz $ YOUR_DEV) - 1024)) count = 1024` jlliagre vor 10 Jahren 5
1
Ignacio Vazquez-Abrams

Use the seek predicate to go to the end of the disk.