1

I have a bunch of disks where the partition tables are very similar (nearly identical)

I need to 'erase' these disks, such that when a new partition table is created any volumes that existed prior to the partition table being deleted do not attempt to be remounted

so in short

   t0:  create partition table, format volumes with ext4
   t1:  delete partition table
   t2:  create same partition table as in t0
   t3:  GOAL: volumes created in t0 are not mounted, recovery is not attempted

my hope is in t3, that the volumes created in t0 are not detected and a recovery attempted.

is there a way of marking an ext4 header as "do not use"? I think I could work something out where I overwrite the ext4 headers, but that feels dirty. Windows has the abilty to create a volume without a filesystem, I'd like something similar for linux

stuck
  • 667
  • 2
  • 10
  • 23
  • 1
    As you suggested, you can overwrite the partition, for example `dd if=/dev/zero of=/dev/sdpartition bs=4k`. If you remove the disks from /etc/fstab, they should not try to automount. – Andrew Domaszek Dec 24 '15 at 23:17
  • and if you are just zeroing them out a larger block size will go faster. you are going to reformat them anyway. bs=2M – Aaron Dec 24 '15 at 23:40
  • thanks for the info, is there a faster way though? I can imagine an ext4 attribute that indicates to the filesystem that the volume is ext4 formatted, is not intact, and mounting should fail I would remove the partitions from fstab, but some of the tools we're using (it's an embedded device) mount the volumes with mount – stuck Dec 25 '15 at 00:33

1 Answers1

-1

t0: Create initial partition table however you'd like, make filesystems however you'd like. Backup partition table: sfdisk -d /dev/sda > sda_table; umount /dev/sda

t1: Delete partition table with dd if=/dev/zero of=/dev/sda bs=512 count=1

t2: Restore partition table with sfdisk /dev/sda < sda_table

t3: Filesystems created in t0 are not mounted and no recovery is attempted

https://wiki.archlinux.org/index.php/Master_Boot_Record

dmourati
  • 24,720
  • 2
  • 40
  • 69
  • am I missing something where the volumes are some how modified not to mount? they will be mounted if only the partition table is deleted and replaced We're using GPT as well – stuck Dec 25 '15 at 12:13