# newfs_msdos: sysctl: KERN_MAXPHYS, using 1048576: Cannot allocate memory



## SteveG1 (Jul 22, 2022)

Hi,

I have `options         MAXPHYS=131072` in my kernel. This fixed the issue I was having with the built-in sata controller. However, when I try to create a fat filesystem, I get:

```
# newfs_msdos /dev/da0s1
/dev/da0s1: 2146959424 sectors in 33546241 FAT32 clusters (32768 bytes/cluster)
BytesPerSec=512 SecPerClust=64 ResSectors=32 FATs=2 Media=0xf0 SecPerTrack=63 Heads=255 HiddenSecs=0 HugeSectors=2147483648 FATsecs=262081 Ro2
newfs_msdos: sysctl: KERN_MAXPHYS, using 1048576: Cannot allocate memory
```
It doesn't matter what drive I try to create it on. It can be a thumb drive and I get that warning. Since it is just a warning, it does create the filesystem. However, it looks like sysctl can not see the size of KERN_MAXPHYS. Is there a work around for this issue?

Thanks!


----------



## SirDice (Jul 22, 2022)

Maybe circle back to why you've set it in the first place. 



SteveG1 said:


> This fixed the issue I was having with the built-in sata controller.


What issue? What did it resolve?

MAXPHYS was defined as 128K (131072) in earlier versions, on 13.0 it was bumped up to 1MB (1048576). So I would really suggest not setting it at all. 



			MAXPHYS bump for FreeBSD 13


----------



## SteveG1 (Jul 22, 2022)

The change to MAXPHYS in 13 means my system would not boot at all or if it did boot the filesystem was forcably unmounted when I tried to write to it. This is the error I get without it: 

Starting file system checks:

```
/dev/ada0s2a: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ada0s2a: clean, 27685390 free (1238 frags, 3460519 blocks, 0.0% fragmentation)
Mounting local filesystems:.
random: unblocking device.
Building /boot/kernel/linker.hints
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 bf 07 0a 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77541081088, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 00 3f 54 0b 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77584662528, length=262144)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 ff 58 0b 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77585285120, length=360448)]error = 22
ugen0.5: <vendor 0x04d9 USB Keyboard> at usbus0
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 ff 68 0b 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
ukbd0g_vfs_done():ada0s2a[READ(offset=77587382272, length=360448)]er on uhub3
ror = 22
ukbd0: <vendor 0x04d9 USB Keyboard, class 0/0, rev 1.10/1.01, addr 5> on usbus0
kbd1 at ukbd0
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 3f 47 0b 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77582958592, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 80 ff 5c 09 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77518700544, length=327680)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 80 3f fd 0a 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77573259264, length=327680)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 40 7f d5 09 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77534494720, length=294912)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 00 3f fc 09 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77539573760, length=262144)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 ff 1f 0b 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77577814016, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 40 7f df 0a 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77569359872, length=294912)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 00 ff fe 09 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77539934208, length=262144)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 bf 5f 0b 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77586169856, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 ff 38 0b 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77581090816, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 3f 32 0a 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77546651648, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 00 3f 87 0a 40 09 00 00 08 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77557792768, length=1048576)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 00 3f 88 0a 40 09 00 00 08 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77557923840, length=1048576)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 3f 88 0a 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77557923840, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 bf 4f 0b 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77584072704, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 3f df 09 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77535772672, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 00 3f 41 0b 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77582172160, length=262144)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 7f f0 09 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77538033664, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 7f b0 09 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77529645056, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 7f 8c 09 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77524926464, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 bf c8 09 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77532823552, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 7f f1 0a 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77571719168, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 7f c2 0a 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77565558784, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 80 bf 16 0b 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77576601600, length=327680)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 ff f5 09 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77538754560, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 3f 64 09 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77519650816, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 3f 64 09 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77519650816, length=360448)]error = 22
fslsata0: DMA load error 27
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 00 3f 67 09 40 09 00 00 08 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77520044032, length=1048576)]efslsata0: DMA load error 27
rror = 22
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 c0 3f 64 09 40 09 00 00 02 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77519650816, length=360448)]erfslsata0: DMA load error 27
ror = 22
(ada0:fslsata0:0:0:0): READ_FPDMA_QUEUED. ACB: 60 00 3f 67 09 40 09 00 00 08 00 00
(ada0:fslsata0:0:0:0): CAM status: CCB request was invalid
(ada0:fslsata0:0:0:0): Error 22, Unretryable error
g_vfs_done():ada0s2a[READ(offset=77520044032, length=1048576)]ekldxref: rror = 22
/boot/kernel/zfs.ko: cannot load DT_RELA section
```


----------

