Last active
August 29, 2015 14:02
-
-
Save aldavud/e5e2f47234135fe193b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def zap(dev) | |
# try to wipe out any GPT partition table backups. | |
# sgdisk isn't too thorough. | |
lba_size = 4096 | |
size = 33 * lba_size | |
begin | |
dev_file = open(dev, 'wb'): | |
dev_file.seek(-size, IO::SEEK_END) | |
dev_file.write("\0" * size) | |
ensure | |
dev_file.close | |
end | |
`sgdisk --zap-all --clear --mbrtogpt -- #{dev}` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment