On 08/08/2014 03:00 PM, Chris Murphy wrote:
On Aug 8, 2014, at 4:29 AM, Robert Moskowitz <rgm@xxxxxxxxxxxxxxx> wrote:
Unfortuately there is no such command to delete all partitions, though you kind of can do it by changing the table type, say from msdos to gpt.
I forgot to address this specifically. First, you really should delete the filesystem signature before deleting partitions. This makes the filesystem invalid, and thus things like libblkid and libparted aren't going to recognize latent (stale) filesystems. The tool for this is wipefs part of util-linux. Use it like this for example:
wipefs -a /dev/sdb[123]
That will delete the fs signatures on all file systems found on partitions 1 through 3 on disk sdb. The partition table still contains entries of course, but the filesystems in them are invalidated.
Next, if you want to get rid of all partitions, you can also use wipefs on a whole disk.
wipefs -a /dev/sdb
??
thanks for all of this.
This removes the signature for the partition table. Most any tool will consider it invalid, rather than broken, so it's not going to offer to fix it, it'll offer to repartition it: so in the GPT case, it gets a whole new disk identifier GUID rather than just restoring the signature. It is possible, btw to restore the signature and thus restore the partition table and all of its partitions (since those sectors aren't actually erased).
You could also blow away 34 sectors from the start and end of the drive using dd if=/dev/zero. That's a hammer.
Oh and I mentioned cgdisk (member of the gdisk family) that was wrong, it's curse-based. You want to look at sgdisk which is for use in scripts and accepts all commands from the CLI. It has a way to delete partitions individually. Note that this does not employ wipefs, so the actual filesystem contained within the partition you've deleted is still intact; and this also leaves the partition header intact, all it's doing is removing a partition table entry. sgdisk also has two zap options: one overwrites everything (sectors containing both MBR and GPT structures), the other option overwrites only the sectors containing GPT structures.
So it really depends what you want to achieve, and how arbitrary the source drives are going to be.
If you're writing a program or script you might look at python-blivet which has done a ton of work abstracting all of this stuff, if you can do what you need to do in python,
No. I am developing my own notes on how to build up a boot card (and
eventually drive) for Redsleeve on my Cubieboard2. At this stage, I
tend to build then break a number of times, so having commands to build
rather than having to use a GUI speeds the rebuild time. But so far no
magic for fstab; I am having to put UUIDs in it.
I have been given nice scripts for F19 & F20 remixes and F21 alpha. We
will see what I will need for Centos7arm development...
I will then be putting all that I did on the Redsleeve wiki.
then you can use sane pthyon code to do things like wipe all fs's, delete all partitions, create new GPT, add new partitions, format them. And you don't need to know the prose for the 5 different utilities to make that happen. python-blivet is actually at the core of the Fedora installer, specifically for manipulating storage (it does everything you can imagine in including create, modify, destroy LVM objects; btrfs subvolumes; bunch of md raid stuff, etc.)
http://pkgs.fedoraproject.org/cgit/python-blivet.git/
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org