~powersj/curtin/add-bionic

« back to all changes in this revision

Viewing changes to curtin/commands/block_meta.py

  • Committer: Scott Moser
  • Author(s): Ryan Harper
  • Date: 2017-10-11 17:13:03 UTC
  • mfrom: (532.1.7 trunk.fix-lp1722322)
  • Revision ID: smoser@ubuntu.com-20171011171303-38zljqh9dp7auo4p
block_meta: use block.wipe_volume(mode=superblock) to clear MBR/GPT tables

In the case curtin is not directed to wipe the partition table via the
wipe: configuration, a disk may contain an MBR and sgdisk --clear does
not successfully wipe MBR tables. Replace the call to sgdisk with curtin
block.wipe_volume(mode=superblock) to clear both MBR and GPT

LP: 1722322

Show diffs side-by-side

added added

removed removed

Lines of Context:
384
384
            LOG.info("labeling device: '%s' with '%s' partition table", disk,
385
385
                     ptable)
386
386
            if ptable == "gpt":
387
 
                util.subp(["sgdisk", "--clear", disk])
 
387
                # Wipe both MBR and GPT that may be present on the disk.
 
388
                # N.B.: wipe_volume wipes 1M at front and end of the disk.
 
389
                # This could destroy disk data in filesystems that lived
 
390
                # there.
 
391
                block.wipe_volume(disk, mode='superblock')
388
392
            elif ptable in _dos_names:
389
393
                util.subp(["parted", disk, "--script", "mklabel", "msdos"])
390
394
            else: