SOLVED? - Re: Command line for creating partitions

Robert Moskowitz rgm at htt-consult.com
Sun Aug 10 03:07:35 UTC 2014


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
wipefs -a /dev/sdb
parted /dev/sdb rm 3
parted /dev/sdb rm 2
parted /dev/sdb rm 1
parted /dev/sdb mklabel msdos (or gpt)

So much nicer what anaconda does in the kickstart with 'clearpart' !  A 
standalone util/script for that is handy for someone working on a USB 
drive of any sort.
>
>
>> 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.
> blkid will get you the UUID and filesystem type so it's a bit easier to build the fstab; otherwise to automate it with command line instead of GUI, you'd look at kickstart installs which leverages anaconda and blivet to do all of these things for you, then does the install per your requirements.
>
> Chris Murphy
>



More information about the users mailing list