Re: gpart, bsdlabel and fdisk

From: Thomas Backman <serenity_at_exscape.org>
Date: Thu, 22 Oct 2009 20:04:34 +0200
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_at_chaos ~]# mkfile -n 2g testdisk
[root_at_chaos ~]# ggatel create -u 2 testdisk
[root_at_chaos ~]# gpart create -s gpt ggate2
ggate2 created
[root_at_chaos ~]# gpart add -s 1G -t freebsd-swap ggate2
ggate2p1 added
[root_at_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
Received on Thu Oct 22 2009 - 16:04:42 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:57 UTC