gpart and bsdlabel

Rolf Nielsen rmg1970swe at gmail.com
Fri Jul 11 21:18:01 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2014-07-11 22:11, Michael W. Lucas wrote:
> Hi,
> 
> I'm gradually switching from the familiar and comfortable agony of 
> fdisk/disklabel to gpart.
> 
> In the past, our org has avoided certain partition letters on
> specific drives. If the drive isn't a boot drive, it has no 'a"
> partition. If it has no swap, it has no 'b' partition.
> 
> gpart assigns partition letters in the order in which they're
> created.
> 
> Is there a way to specify which partition letter you want to
> create, or start with, or something?
> 
> Thanks, ==ml
> 

I just created a 10 GB file backed md device, and did some experiments
with gpart. Here's the result.

root at lazlar:/misc/cdrecorder/Film # gpart create -s MBR md0
md0 created
root at lazlar:/misc/cdrecorder/Film # gpart add -t freebsd md0
md0s1 added
root at lazlar:/misc/cdrecorder/Film # gpart create -s BSD md0s1
md0s1 created
root at lazlar:/misc/cdrecorder/Film # gpart add -b 16 -s 4G -t
freebsd-ufs -i 6 md0s1
md0s1f added
root at lazlar:/misc/cdrecorder/Film # gpart add -b 8388624 -t
freebsd-swap -i 2 md0s1
md0s1b added
root at lazlar:/misc/cdrecorder/Film # bsdlabel md0s1
# /dev/md0s1:
8 partitions:
#          size     offset    fstype   [fsize bsize bps/cpg]
  b:   12582816    8388624      swap
  c:   20971440          0    unused        0     0     # "raw" part,
don't edit
  f:    8388608         16    4.2BSD        0     0     0

It seems the partition letters can be assigned dynamically, using the
- -i option to gpart add.

Rolf
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJTwFSEAAoJEB1OKfQ0M8TgLNsQAOGyOCjSTnjPYcvAUha+rDUc
ixtmuhDubex7Ri2hcg5ThYdkQ23cyliL1b/uppnRU6JAfiucuLYc5yHzxAStZ+ET
YdkOyGlwAKCJ7RpT5pGc3cv6xdCqXO1p6MLaZd2UOFoqhKy/jW+eLtpp+6s+FTTj
Bhz5V+Sp11GOo5T+HdoTa9ixvLP98uH58h9f8za7Kh8Q/gvB+GL8C7ruxInJGlvs
LbyVyOmvozhxbnY/80HpcCUfc4eLlkJ3RzRDwQGsSqAvV0pfczRgmjCbzRHqVkIV
ggRDohEzFWXO39VDSaTQpE407ORcuvgPcENgQO9ftI52eCVSv0FgC6kGje4VitDO
D4De9IefMk2kppiX2RQ5sVxHWTOa59iTFmjn5HgnoTs2pms1ubyzeZJyWXr97s5j
WGI9sDOzXJ9Io2k1J19pXP46DMqn8TqaoC5OK079pBpzvj50+xNXfy0CZ09UFjfY
XSLnI3htGV4LEAXrj77rFBZLiRYPuGaesFGxK+Y9U10ecXm2WleYUG0fUqvbv91+
BOsf1uXhp/4aWNtPjW+Cot/hhoop0j8U7B0Z0gKjAqGlsy8uBa+pxwsmPoDyR6Fz
F9z95Pl7vLRgvCZa2RSgcsm3JhgpTZVAVl9RtOQuVUQRqlckw0TzpL6PRu0PYara
lyCVNp/8JzQt/cJ1TW+3
=viUr
-----END PGP SIGNATURE-----


More information about the freebsd-questions mailing list