SOLVED? - Re: Command line for creating partitions

Robert Moskowitz rgm at htt-consult.com
Sun Aug 10 23:47:13 UTC 2014


On 08/10/2014 05:20 PM, Chris Murphy wrote:
> On Aug 9, 2014, at 9:07 PM, Robert Moskowitz <rgm at htt-consult.com> wrote:
>
>> On 08/08/2014 06:11 PM, Chris Murphy wrote:
>>> On Aug 8, 2014, at 2:16 PM, Robert Moskowitz <rgm at htt-consult.com> wrote:
>>>
>>>> On 08/08/2014 03:00 PM, Chris Murphy wrote:
>>>>> On Aug 8, 2014, at 4:29 AM, Robert Moskowitz <rgm at htt-consult.com> 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
>>> That will only remove signatures from either an MBR or GPT. It will not remove signatures from filesystems. You really should remove filesystem signatures first with /dev/sdX[1234…] and then remove the partition map sig with sdX alone.
>> I was very unclear, that is what I meant, that I got the remove sigs for each partition, but I am assuming that the command for the partition part was what I gave.  So the whole set is:
>>
>> wipefs -a /dev/sdb1
>> wipefs -a /dev/sdb2
>> wipefs -a /dev/sdb3
> Sure. These can be combined as:
> wipefs -a /dev/sdb[123]
>
> There are quite a few examples of this, including making LVM pvs, and Btrfs volumes, e.g.
> mkfs.btrfs -mraid1 -draid1 /dev/sdb[123]
>
> And also for multiple disk partition table obliteration:
> wipefs -a /dev/sd[bcd]
>
> I like wipefs because it tells you what it's removing, so you can restore it, and also has an option for backing up that which it's removing so you can easily restore it if you got sloppy with the command and bashed the wrong device. Not that this should be habit forming, like being able to make a proper gimlet.


Thanks for all the help.  And I figured out another way when you want a 
real clean card for dd of an image then xz for a compressed form for 
distribution.  I did:

dd if=/dev/zero of=/dev/sdb bs=1M

and everything is gone.  Built the partition table, the partitions, laid 
down the files, booted up clean, then dd the image, xz compressed it and 
I now have a ice compressed image I can restore to start at a clean 
point and can distribute to others.

Making slow, steady progress.  Maybe not as good as other more 
experienced, but hey, for a change I will be providing something. In 
particular Redsleeve for Cubieboards.


>
>> So much nicer what anaconda does in the kickstart with 'clearpart' !
> Yes and blivet makes an appearance in F21 proper although I'm not sure yet if this is an API or how it'll get leveraged. Another pony trick is system-storage-manager package, which takes the form of ssm on the command line; but this tool is post partition management, working with LVM and filesystems.
>
>
> Chris Murphy
>



More information about the users mailing list