Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Oct 2009 20:04:34 +0200
From:      Thomas Backman <serenity@exscape.org>
To:        Scot Hetzel <swhetzel@gmail.com>
Cc:        freebsd-current@freebsd.org, Aristedes Maniatis <ari@ish.com.au>
Subject:   Re: gpart, bsdlabel and fdisk
Message-ID:  <8AC915BF-E826-4D90-8DD3-00E7FF7F4295@exscape.org>
In-Reply-To: <790a9fff0910221049n130c5b00x66071a5a718eb6ab@mail.gmail.com>
References:  <4ADE995A.8080009@ish.com.au> <1256174188.2309.22.camel@balrog.2hip.net> <4ADFCFF3.1030201@ish.com.au> <790a9fff0910220001m3d7df03j127b51d7d0696271@mail.gmail.com> <4AE01342.4000303@ish.com.au> <790a9fff0910221049n130c5b00x66071a5a718eb6ab@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Oct 22, 2009, at 7:49 PM, Scot Hetzel wrote:

> All the guides I had read regarding creating partitions with gpart had
> used # sectors instead of specifying the size as 8G.  According to
> Oliver Roberts ZFS guide (see http://www.keltia.net/howtos/zfsboot),
> in order to create a 512MB swap, you have to double the number to get
> 1G.

Actually, there's a typo in the guide. When you specify 1G, that means  
1 GiB, not "1 gigasectors".
"gpart add -b 162 -s 1G -t freebsd-swap da0..da1        512 MB swap"
^ should read 1G(i)B swap. "1G" = 1 GiB = 1024*1024*1024 bytes.

This is with GPT, but stilll valid:

[root@chaos ~]# mkfile -n 2g testdisk
[root@chaos ~]# ggatel create -u 2 testdisk
[root@chaos ~]# gpart create -s gpt ggate2
ggate2 created
[root@chaos ~]# gpart add -s 1G -t freebsd-swap ggate2
ggate2p1 added
[root@chaos ~]# gpart show ggate2
=>     34  4194237  ggate2  GPT  (2.0G)
        34  2097152       1  freebsd-swap  (1.0G)
   2097186  2097085          - free -  (1.0G)
As you can see, the partition ends up 2097152 sectors * 512 bytes =  
1073741824 bytes = exactly 1024*1024*1024 bytes or 1 GiB.


Regards,
Thomas



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8AC915BF-E826-4D90-8DD3-00E7FF7F4295>