GPT vs MBR for swap devices

Mark Millard marklmi at yahoo.com
Sat Jun 23 14:50:07 UTC 2018


On 2018-Jun-23, at 7:32 AM, bob prohaska <fbsd at www.zefox.net> wrote:

> On Fri, Jun 22, 2018 at 12:08:56PM +1000, Trev wrote:
>> 
>> 
>> Unfortunately my rpi3B+ is not a direct comparison with the rpi2B 
>> because I only had the one USB2 memory device holding /usr, /usr/obj and 
>> swap. I'll try moving swap to a dedicated USB2 memory device.
> 
> Have you considered putting a swapfile on the microSD card? That's one
> of the things I have not tried. A swap partition on SD seems to work. 
> A swapfile is easier to try and may work. 

See:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206048

for why I would not recommend using a swap file. In particular
comment 7 is a quote:

> On 2017-Feb-13, at 7:20 PM, Konstantin Belousov <kostikbel at gmail.com> wrote
> on the freebsd-arm list:
> 

> . . .
> 
> swapfile write requires the write request to come through the filesystem
> write path, which might require the filesystem to allocate more memory
> and read some data. E.g. it is known that any ZFS write request
> allocates memory, and that write request on large UFS file might require
> allocating and reading an indirect block buffer to find the block number
> of the written block, if the indirect block was not yet read.
> 
> As result, swapfile swapping is more prone to the trivial and unavoidable
> deadlocks where the pagedaemon thread, which produces free memory, needs
> more free memory to make a progress.  Swap write on the raw partition over
> simple partitioning scheme directly over HBA are usually safe, while e.g.
> zfs over geli over umass is the worst construction.


Comment 3 from Tom Vijlbrief even reports a way to reproduce
such a problem with swap files:

> This is not related to ARM or USB, I can reproduce it in a VirtualBox amd64 client with the standard emulated hard disk.
> 
> . . .
> 
> stress -d 2 -m 3 --vm-keep
> 
> will hang the system as well.


(This was on 2016-Jan-22.)

Another reproduction report is Comment 5 from Sevan Janiyan:

> In my case, to reproduce the behaviour, boot PI, add swap file as per handbook instructions[1], run cat /somefile > /someotherfile
> 
> In this case /somefile is a 4GB file containing garbage from /dev/urandom






===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)



More information about the freebsd-arm mailing list