When building a bootable image for SD card or other such flash memory, it would be nice to add the swap slice first, setting its size, and subsequently add the freebsd slice, letting gpart just use whatever space is left on the device. Is this possible? Does it affect booting?
Doesn't seem that simple in my experience. For instance, consider your online example. There is first required space for the boot slice. Then, the second slice has to start at 1MB boundary. So, if I start with a 2GB SD card, then I guess that if I...
The first meg is used for the boot partition and unused space. So calculate the disk capacity in meg (diskinfo(8) will show it) and subtract one meg. Actually, I'd subtract two meg, to allow for rounding and leave 1M or less unused at the end of the drive.
The remainder is the size to use for the main partition.
For example: 8G drive is truly 8G, 8192M. Swap is desired to be 512M, so:
8192-2= 8190
8190-512= 7678
In a shorter form: capacity in M - (swapsize in M + 2M) = main partition size in M:
8192 - (512 + 2) = 7678
The size values can be specified in blocks, K, M, or G.
That -a1M is to make sure the swap partition is an even multiple of 1M. That will also make it an even multiple of 4K for Advanced Format drives, and does no harm on 512-byte block drives.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.