add swap on a rpi3

Ian Lepore ian at freebsd.org
Sat Jul 14 18:15:03 UTC 2018


On Sat, 2018-07-14 at 20:12 +0200, Per olof Ljungmark wrote:
> On 07/14/18 19:41, Ian Lepore wrote:
> > 
> > On Sat, 2018-07-14 at 19:28 +0200, Per olof Ljungmark wrote:
> > > 
> > > 12.0-CURRENT #0 r336134 arm64 GENERIC on a rpi3 Cortex-A53
> > > 
> > > Can I add a swap "partition" somewhere below? I am booting from
> > > the
> > > SD
> > > card and run the system from an attached USB disk.
> > > 
> > > As I understand it, I cannot create a freebsd-swap
> > > partition/slice
> > > with
> > > the BSD/MBR scheme, but is there another way to create a
> > > reasonably
> > > large swap (>1G) under ARM?
> > > 
> > > =>      63  31116225  mmcsd0  MBR  (15G)
> > >         63      2016          - free -  (1.0M)
> > >       2079    102312       1  fat32lba  [active]  (50M)
> > >     104391  31008825       2  freebsd  (15G)
> > >   31113216      3072          - free -  (1.5M)
> > > 
> > > =>       0  31008825  mmcsd0s2  BSD  (15G)
> > >          0        57            - free -  (29K)
> > >         57  31008768         1  freebsd-ufs  (15G)
> > > 
> > > =>       63  125045361  da0  MBR  (60G)
> > >          63       2016       - free -  (1.0M)
> > >        2079     102312    1  fat32lba  [active]  (50M)
> > >      104391   83884089    2  freebsd  (40G)
> > >    83988480   41056944       - free -  (20G)
> > > 
> > > =>       0  83884089  da0s2  BSD  (40G)
> > >          0        57         - free -  (29K)
> > >         57  83884032      1  freebsd-ufs  (40G)
> > > 
> > > 
> > Looks like you've got some free space is on da0, so:
> > 
> >  gpart add -t freebsd -s <slicesize> -i 3 da0
> >  gpart create -s bsd da0s3
> >  gpart add -t freebsd-swap -s <swapsize> -i 2 da0s3
> > 
> > Now you have a swap parition at da0s3b (-i 2/partition b is sort of
> > traditional for freebsd swap partitions, but there's no real need
> > for
> > it to be so).
> > 
> > You can make the size of da0s3 bigger than 1g, and then carve out
> > just
> > 1g of it for swap, leaving space to add ufs partitions in that
> > slice
> > later if you want.
> Thank you for the quick answer!
> 
> I had missed "gpart create -s bsd" part.
> 
> Just one more question, why "-i 2" here:
> gpart add -t freebsd-swap -s <swapsize> -i 2 da0s3
> 
> Could not as well be "-i 1" ?
> 

It could be -i 1, then the swap partition would be da0s3a instead of
s3b. There is no reason I know of other than freebsd tradition to make
a swap partition be -i 2.

-- Ian



More information about the freebsd-arm mailing list