Re: gpart, bsdlabel and fdisk




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
_______________________________________________
freebsd-current@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@xxxxxxxxxxx"