Fix cleaning boot sectors of disks on delete

Bootloaders may check MBR signature to determine,
if it can boot from thios disk. So let's clear it
together with boot code.

Also #{dev[:name]} is just a name of a device, like
sdb, so add /dev/ path.

Change-Id: Ifc23fe4e4919a10b3d5546c98ee333ccac9c92f2
This commit is contained in:
Dmitry Guryanov 2016-04-28 19:22:46 +03:00
parent 94c96e3582
commit 3c00fb6550
1 changed files with 3 additions and 1 deletions

View File

@ -116,7 +116,9 @@ module MCollective
get_devices(type='all').each do |dev|
debug_msg("erasing bootstrap code area in MBR of #{dev[:name]}")
# clear out the boot code in MBR
system("dd if=/dev/zero of=#{dev[:name]} bs=446 count=1")
system("dd if=/dev/zero of=/dev/#{dev[:name]} bs=446 count=1")
# clear out the signature
system("dd if=/dev/zero of=/dev/#{dev[:name]} seek=510 bs=1 count=2")
system("sync")
end