using dd for clean MBR code doesn't work on pfSense
0
votes
3
answers
276
views
Trying to clean the mbr code part on a disk using the pfsense 2.7.0 live disk (pfsense is based on freebsd) under shell command.
being **/dev/da0** my drive following the suggested code for clean just the mbr code keeping the partitions the command should be:
dd if=/dev/zero of=/dev/da0 bs=446 count=1
however... the result is:
dd: /dev/da0: Invalid argument
1+0 records in
0+0 records out
0 bytes transferred in 0.000089 secs (0 bytes/sec)
instead... if I use as code just
dd if=/dev/zero of=/dev/da0
it just erases everything without errors :(
I'm doing this tests in a vm so I can recover the hd many times to test this passage... however this thing is giving me headaches...
**EDIT:** It seems that if I use bs=512
or bs=1M
it doesn't gives errors. However doing so also the partitions table part would be deleted...
**EDIT2:** I tried to use the command dd if=/dev/da0 of=/tmp/mbr_file bs=512 count=1
and it create for me a file with the mbr, I wonder what commands can I use for edit in binary mode the file filling the first 446 bytes with 0 and then use dd if=/tmp/mbr_file of=/dev/da0 bs=512 count=1
to restore it.
What could I use? vi?
Asked by user3450548
(3094 rep)
Oct 3, 2023, 09:56 PM
Last activity: Oct 4, 2023, 07:25 PM
Last activity: Oct 4, 2023, 07:25 PM