gpart, bsdlabel and fdisk
Thomas Backman
serenity at exscape.org
Thu Oct 22 18:04:42 UTC 2009
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
More information about the freebsd-current
mailing list