modprobe error: could not insert 'ext3': Device or resource busy - linux-kernel

I'm working towards understanding the ext3 file system. i have added printk statements into the files inside kernel source files of ext3, to see how things get executed by watching the kernel buffer messages (dmesg). I have followed the steps given in this link: https://askubuntu.com/questions/168279/how-do-i-build-a-single-in-tree-kernel-module . i am using following commands to build ext3 as a module to experiment on it by loading and unloading it using modprobe.
The commands are:
cd $HOME/linux-3.12.36/
make oldconfig # copy old .config to ./
vi .config # i have made CONFIG_EXT3_FS=m
make prepare
make modules_prepare
make SUBDIRS=scripts/mod
make SUBDIRS=fs/ext3 modules
# Then I created 'ext3' directory in /lib/modules/3.12.36/kernel/fs, which was not there earlier.
cp fs/ext3/ext3.ko /lib/modules/3.12.36/kernel/fs/ext3/
depmod
modprobe ext3
all executes ok... except the last statement which gives the error:
modprobe: ERROR: could not insert 'ext3': Device or resource busy.
my lsmod result in case helpfull:
Module Size Used by
ums_realtek 18045 0
usb_storage 62230 1 ums_realtek
auth_rpcgss 59261 0
rfcomm 69078 0
bnep 19704 2
bluetooth 372312 10 bnep,rfcomm
sunrpc 284347 2 auth_rpcgss
arc4 12608 2
iwldvm 236564 0
snd_hda_codec_hdmi 41149 1
snd_hda_codec_realtek 56979 1
mac80211 607387 1 iwldvm
snd_hda_intel 56546 3
snd_hda_codec 192906 3 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_intel
i915 711131 8
snd_hwdep 13602 1 snd_hda_codec
snd_pcm 102042 3 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel
iwlwifi 165575 1 iwldvm
snd_page_alloc 18710 2 snd_pcm,snd_hda_intel
snd_seq_midi 13324 0
snd_seq_midi_event 14899 1 snd_seq_midi
parport_pc 32741 0
snd_rawmidi 30144 1 snd_seq_midi
uvcvideo 80843 0
snd_seq 61560 2 snd_seq_midi_event,snd_seq_midi
snd_seq_device 14497 3 snd_seq,snd_rawmidi,snd_seq_midi
videobuf2_vmalloc 13216 1 uvcvideo
snd_timer 29427 2 snd_pcm,snd_seq
videobuf2_memops 13362 1 videobuf2_vmalloc
cfg80211 483503 3 iwlwifi,mac80211,iwldvm
videobuf2_core 40625 1 uvcvideo
ppdev 17635 0
snd 69274 17 snd_hda_codec_realtek,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_seq,snd_rawmidi,snd_hda_codec,snd_hda_intel,snd_seq_device,snd_seq_midi
intel_powerclamp 14727 0
drm_kms_helper 52758 1 i915
videodev 134093 2 uvcvideo,videobuf2_core
drm 297924 4 i915,drm_kms_helper
lp 17759 0
dell_laptop 17369 0
dcdbas 14888 1 dell_laptop
dell_wmi 12681 0
joydev 17393 0
sparse_keymap 13948 1 dell_wmi
coretemp 13435 0
i2c_algo_bit 13413 1 i915
shpchp 37047 0
mei_me 18437 0
kvm_intel 143006 0
mei 78023 1 mei_me
lpc_ich 21093 0
parport 42313 3 lp,ppdev,parport_pc
serio_raw 13483 0
kvm 445551 1 kvm_intel
intel_ips 18484 0
soundcore 12680 1 snd
wmi 19193 1 dell_wmi
video 19058 1 i915
psmouse 106319 0
ahci 29929 5
atl1c 46050 0
libahci 32009 1 ahci
after observing lsmod you can see that there is no ext3 or jbd module. What am i missing here or why else there is no ext3 module. yet i have installed my operating system on a drive partitioned with ext3.
i have unloaded the ext3 module for inserting my own, by typing:
modprobe -r ext3
and then,
modeprobe ext3
But still the error persists. Please help me to solve the modprobe problem.
PS: I'm using Ubuntu.

Related

Is there any specific way to extract SSD name without "/"?

In my current system, I have 3 SSDs, sda, sdb and sdc. The OS is installed in sdc.
I am trying to extract the SSDs without the OS installed in it. So, this command
echo $(eval $(lsblk -oMOUNTPOINT,PKNAME -P | grep 'MOUNTPOINT="/"'); echo $PKNAME | sed 's/[0-9]*$//')
returns sdc.
But if I want the drive without OS, how should I modify the above command?
grep 'MOUNTPOINT!="/"' doesn't return anything.
The bash script provided by Renaud works as expected on systems with raw drives. In case, if the system has LVM partitions then it returns only dm-1.
How to handle this case? To get the correct SSD name on either raw or LVM systems?
On the LVM system, lsblk returns. The expected output is sdb
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 1.8T 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 1.8T 0 part
├─ubuntu--vg-ubuntu--lv-real
│ 253:1 0 880G 0 lvm
│ ├─ubuntu--vg-ubuntu--lv 253:2 0 880G 0 lvm /
│ └─ubuntu--vg-clean 253:4 0 880G 0 lvm
└─ubuntu--vg-clean-cow 253:3 0 400G 0 lvm
└─ubuntu--vg-clean 253:4 0 880G 0 lvm
sdb 8:16 0 1.8T 0 disk
On the raw drive, lsblk returns
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
sdb 8:16 0 465.8G 0 disk
├─sdb1 8:17 0 2G 0 part
└─sdb2 8:18 0 463.8G 0 part
sdc 8:32 0 232.9G 0 disk
├─sdc1 8:33 0 156M 0 part /boot/efi
├─sdc2 8:34 0 26.7G 0 part /boot
├─sdc3 8:35 0 182.7G 0 part /
└─sdc4 8:36 0 23.4G 0 part [SWAP]
Here the expected output is sda or sdc.
grep has a -v option to print only non-matching lines. So:
lsblk -oMOUNTPOINT,PKNAME -P | grep -v 'MOUNTPOINT="/"'
should exclude this drive. But note that if you have more than one other drive the rest of your script will not work as you would like. Only the last drive will be considered because it overrides the others. A loop would probably be closer to your needs:
while IFS= read -r line; do
eval "$line"
sed 's/[0-9]*$//' <<< "$PKNAME"
done < <(lsblk -oMOUNTPOINT,PKNAME -P | grep -v 'MOUNTPOINT="/"')

make zpool status output scriptable

How can I turn the output of zpool status -v into something usable, with data that match by row in a data.oriented format, instead of the silly "visual" output it uses, so that it's something scriptable, using standard unix-like utilities? I had a python script that did something acceptable, but python 3 completely breaks it, and I'm not fixing it just to have some new version of python break it again. (after screwing around getting the script to run with no errors, it returns nothing :)
bascially this space-bar alinged mess:
pool: data
state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(7) for details.
scan: scrub repaired 0 in 4h52m with 0 errors on Fri Aug 18 04:52:47 2017
config:
NAME STATE READ WRITE CKSUM
data ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
gptid/6dfb7dbe-68c5-11e6-982d-00e04c68f511 ONLINE 0 0 0
gptid/27f40ebe-8f1b-11e4-94f8-3085a9405b85 ONLINE 0 0 0
gptid/9244318f-c1b4-11e6-a31d-0cc47ae2abe8 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
gptid/1993f2d7-8f1b-11e4-94f8-3085a9405b85 ONLINE 0 0 0
gptid/529e2c88-f1d1-11e6-89c3-0cc47ae2abe8 ONLINE 0 0 0
gptid/53a09a3e-f1d1-11e6-89c3-0cc47ae2abe8 ONLINE 0 0 0
mirror-2 ONLINE 0 0 0
gptid/51f3b377-6a20-11e6-be8c-00e04c68f511 ONLINE 0 0 0
gptid/9fb54bde-1e2d-11e7-a83e-0cc47ae2abe8 ONLINE 0 0 0
gptid/9eebde32-1e2d-11e7-a83e-0cc47ae2abe8 ONLINE 0 0 0
cache
gptid/63db5172-20bd-11e7-b561-0cc47ae2abe8 ONLINE 0 0 0
errors: No known data errors
to something with actual columnns like this:
NAME STATE READ WRITE CKSUM
data ONLINE 0 0 0
data mirror-0 ONLINE 0 0 0
data mirror-0 gptid/6dfb7dbe-68c5-11e6-982d-00e04c68f511 ONLINE 0 0 0
data mirror-0 gptid/27f40ebe-8f1b-11e4-94f8-3085a9405b85 ONLINE 0 0 0
data mirror-0 gptid/9244318f-c1b4-11e6-a31d-0cc47ae2abe8 ONLINE 0 0 0
data mirror-1 ONLINE 0 0 0
data mirror-1 gptid/1993f2d7-8f1b-11e4-94f8-3085a9405b85 ONLINE 0 0 0
data mirror-1 gptid/529e2c88-f1d1-11e6-89c3-0cc47ae2abe8 ONLINE 0 0 0
data mirror-1 gptid/53a09a3e-f1d1-11e6-89c3-0cc47ae2abe8 ONLINE 0 0 0
data mirror-2 ONLINE 0 0 0
data mirror-2 gptid/51f3b377-6a20-11e6-be8c-00e04c68f511 ONLINE 0 0 0
data mirror-2 gptid/9fb54bde-1e2d-11e7-a83e-0cc47ae2abe8 ONLINE 0 0 0
data mirror-2 gptid/9eebde32-1e2d-11e7-a83e-0cc47ae2abe8 ONLINE 0 0 0
data cache
data cache gptid/63db5172-20bd-11e7-b561-0cc47ae2abe8 ONLINE 0 0 0
I can use perl to remove and rearrange, but I can't work out how to match the rows dynamically, in a way that would work with mirror/raidz123/stripe/cache.
datadata ONLINE 0 0 0
data mirror-0 ONLINE 0 0 0
data gptid/6dfb7dbe-68c5-11e6-982d-00e04c68f511 ONLINE 0 0 0
data gptid/27f40ebe-8f1b-11e4-94f8-3085a9405b85 ONLINE 0 0 0
data gptid/9244318f-c1b4-11e6-a31d-0cc47ae2abe8 ONLINE 0 0 0
data mirror-1 ONLINE 0 0 0
data gptid/1993f2d7-8f1b-11e4-94f8-3085a9405b85 ONLINE 0 0 0
data gptid/529e2c88-f1d1-11e6-89c3-0cc47ae2abe8 ONLINE 0 0 0
data gptid/53a09a3e-f1d1-11e6-89c3-0cc47ae2abe8 ONLINE 0 0 0
data mirror-2 ONLINE 0 0 0
data gptid/51f3b377-6a20-11e6-be8c-00e04c68f511 ONLINE 0 0 0
data gptid/9fb54bde-1e2d-11e7-a83e-0cc47ae2abe8 ONLINE 0 0 0
data gptid/9eebde32-1e2d-11e7-a83e-0cc47ae2abe8 ONLINE 0 0 0
datacache
data gptid/63db5172-20bd-11e7-b561-0cc47ae2abe8 ONLINE 0 0 0
This is the code that generates the above.
zpool status -v data | sed '/ data/, $!d' | grep -v errors: > /tmp/diskslistzpoolstatusdata
perl -pi -e 's/^\n$//' /tmp/diskslistzpoolstatusdata #remove blank lines
perl -pi -e 's/\t$//' /tmp/diskslistzpoolstatusdata
perl -p -i -e 's/\t//g' /tmp/diskslistzpoolstatusdata
perl -pi -e 's/^/data/' /tmp/diskslistzpoolstatusdata
extra:
include the scrub summary and error lines per gptid
NAME STATE READ WRITE CKSUM
misc ONLINE 0 0 0
misc mirror-0 ONLINE 0 0 0
misc mirror-0 gptid/aefbaf6e-e004-11e6-8f42-0cc47ae2abe8 ONLINE 0 0 0 0err/4h52m/0err/Fri Aug 18 04:52:47 2017 No known data errors
misc mirror-0 gptid/affc3cac-e004-11e6-8f42-0cc47ae2abe8 ONLINE 0 0 0 0err/4h52m/0err/Fri Aug 18 04:52:47 2017 No known data errors
misc cache gptid/3139819b-20bd-11e7-b561-0cc47ae2abe8 ONLINE 0 0 0 0err/4h52m/0err/Fri Aug 18 04:52:47 2017 No known data errors
Unfortunately there is no integrated solution available. You have two options:
Parse it yourself in a language of your choice. You already extracted the essential information. The layout is relatively static, as vdevs and pools cannot be nested (pools contain vdevs, never pools themselves), the order is respected (no devices from vdev A come after vdev B), the keywords are few and fixed (mirror-N, raidzX-N, etc), and the output is quite small (less than hundreds of lines usually). This means you just have to go through each row, read the info you need, store it in nested objects or simply arrays and go to the next line.
Directly call the appropriate C functions to get the status in non-readable form and convert the output. To do this, have a look at status_callback(zpool_handle_t *zhp, void *data), where all printf-output is generated from the pool data. You could mirror this function to convert the output into a format you like instead of the indented format, and then call your mini-application from your script to give you your data.
If you are familiar with C, option 2 would be faster I think. Performance-wise it does not matter much, as the data is small (even on big systems) and the calls will most likely be very infrequent (as pool layouts do not change often).

how can I append an entry to a fstab next to a last line entry?

Hi Im writing a shell script that will append below entry to fstab on multiple server.
/dev/vg00/lv_berf /opt/berf ext3 defaults 1 2
/dev/vg00/lv_vberf /var/opt/berf ext3 defaults 1 2
But some fstab has different entry example
fstab on server1:
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/vg00/lv_swap swap swap defaults 0 0
########### ABCD specific FS ############################################
/dev/vgabdc/lv_apal3 /opt/apal3 ext3 defaults 1 2
fstab on server 2
/
dev/vgabc/lv_vabc /var/opt/das ext3 defaults 1 2
/dev/vgabc/lv_vabcoracle /var/opt/oracle/abc ext3 defaults 1 2
/dev/vgabc/lv_vgdb20u01 /var/opt/vgdb20 ext3 defaults 1 2
/dev/vgabc/lv_dasredprairie /opt/redprairie ext3 defaults 1 2
/dev/vgabc/lv_common /opt/common ext3 defaults 1 2
########### ABCD Failover filesystems ############################################
/dev/vgabcd/lv_apal3 /abcd/opt/apal3 ext3 defaults 1 2
I want it to be appended before "########### ABCD ..." and next to the last entry
fstab on server 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/vg00/lv_swap swap swap defaults 0 0
/dev/vg00/lv_berf /opt/berf ext3 defaults 1 2
/dev/vg00/lv_vberf /var/opt/berf ext3 defaults 1 2
########### ABCD specific FS ############################################
/dev/vgabdc/lv_apal3 /opt/apal3 ext3 defaults 1 2
fstab on server 2
/dev/vgabc/lv_vabc /var/opt/das ext3 defaults 1 2
/dev/vgabc/lv_vabcoracle /var/opt/oracle/abc ext3 defaults 1 2
/dev/vgabc/lv_vgdb20u01 /var/opt/vgdb20 ext3 defaults 1 2
/dev/vgabc/lv_dasredprairie /opt/redprairie ext3 defaults 1 2
/dev/vgabc/lv_common /opt/common ext3 defaults 1 2
/dev/vg00/lv_berf /opt/berf ext3 defaults 1 2
/dev/vg00/lv_vberf /var/opt/berf ext3 defaults 1 2
########### ABCD Failover filesystems ############################################
/dev/vgabcd/lv_apal3 /abcd/opt/apal3 ext3 defaults 1 2
I have a working script using sed
line_count=`ssh $i grep -n "ABCD" fstab | cut -d: -f1`
next_line=$((line_count + 1))
ssh $i sed -i "${line_count}i\ '/dev/vg00/lv_berf /opt/berf ext3 defaults 1 2'" fstab
ssh $i sed -i "${next_line}i\ '/dev/vg00/lv_vberf /var/opt/berf ext3 defaults 1 2'" fstab
Problem is when the fstab entry has a space before ABCD it will append next to the space. like the example on fstab on server1 it has space before ###ABCD so when the script run it will look below:
tab1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/vg00/lv_swap swap swap defaults 0 0
/dev/vg00/lv_berf /opt/berf ext3 defaults 1 2
/dev/vg00/lv_vberf /var/opt/berf ext3 defaults 1 2
########### ABCD specific FS ############################################
/dev/vgabdc/lv_apal3 /opt/apal3 ext3 defaults 1 2
How can a fix that with out affecting the other entry on fstab on server 2 which has different last entry?
use function addmntent()
see man page of addmntent

Mac OS X: GNU parallel can't find the number of cores on a remote server

I used homebrew to install GNU parallel on my mac so I can run some tests remotely on my University's servers. I was quickly running through the tutorials, but when I ran
parallel -S <username>#$SERVER1 echo running on ::: <username>#$SERVER1
I got the message
parallel: Warning: Could not figure out number of cpus on <username#server> (). Using 1.
Possibly related, I never added parallel to my path and got the warning that "parallel" wasn't a recognized command, but parallel ran anyways and still echo'd correctly. This particular server has 16 cores, how can I get parallel to recognize them?
GNU Parallel is less tested on OS X as I do not have access to an OS X installation, so you have likely found a bug.
GNU Parallel has since 20120322 used these to find the number of CPUs:
sysctl -n hw.physicalcpu
sysctl -a hw 2>/dev/null | grep [^a-z]physicalcpu[^a-z] | awk '{ print \$2 }'
And the number of cores:
sysctl -n hw.logicalcpu
sysctl -a hw 2>/dev/null | grep [^a-z]logicalcpu[^a-z] | awk '{ print \$2 }'
Can you test what output you get from those?
Which version of GNU Parallel are you using?
As a work around you can force GNU Parallel to detect 16 cores:
parallel -S 16/<username>#$SERVER1 echo running on ::: <username>#$SERVER1
Since version 20140422 you have been able to export your path to the remote server:
parallel --env PATH -S 16/<username>#$SERVER1 echo running on ::: <username>#$SERVER1
That way you just need to add the dir where parallel lives on the server to your path on local machine. E.g. parallel on the remote server is in /home/u/user/bin/parallel:
PATH=$PATH:/home/u/user/bin parallel --env PATH -S <username>#$SERVER1 echo running on ::: <username>#$SERVER1
Information for Ole
My iMac (OSX MAvericks on Intel core i7) gives the following, which all looks correct:
sysctl -n hw.physicalcpu
4
sysctl -a hw
hw.ncpu: 8
hw.byteorder: 1234
hw.memsize: 17179869184
hw.activecpu: 8
hw.physicalcpu: 4
hw.physicalcpu_max: 4
hw.logicalcpu: 8
hw.logicalcpu_max: 8
hw.cputype: 7
hw.cpusubtype: 4
hw.cpu64bit_capable: 1
hw.cpufamily: 1418770316
hw.cacheconfig: 8 2 2 8 0 0 0 0 0 0
hw.cachesize: 17179869184 32768 262144 8388608 0 0 0 0 0 0
hw.pagesize: 4096
hw.busfrequency: 100000000
hw.busfrequency_min: 100000000
hw.busfrequency_max: 100000000
hw.cpufrequency: 3400000000
hw.cpufrequency_min: 3400000000
hw.cpufrequency_max: 3400000000
hw.cachelinesize: 64
hw.l1icachesize: 32768
hw.l1dcachesize: 32768
hw.l2cachesize: 262144
hw.l3cachesize: 8388608
hw.tbfrequency: 1000000000
hw.packages: 1
hw.optional.floatingpoint: 1
hw.optional.mmx: 1
hw.optional.sse: 1
hw.optional.sse2: 1
hw.optional.sse3: 1
hw.optional.supplementalsse3: 1
hw.optional.sse4_1: 1
hw.optional.sse4_2: 1
hw.optional.x86_64: 1
hw.optional.aes: 1
hw.optional.avx1_0: 1
hw.optional.rdrand: 0
hw.optional.f16c: 0
hw.optional.enfstrg: 0
hw.optional.fma: 0
hw.optional.avx2_0: 0
hw.optional.bmi1: 0
hw.optional.bmi2: 0
hw.optional.rtm: 0
hw.optional.hle: 0
hw.cputhreadtype: 1
hw.machine = x86_64
hw.model = iMac12,2
hw.ncpu = 8
hw.byteorder = 1234
hw.physmem = 2147483648
hw.usermem = 521064448
hw.pagesize = 4096
hw.epoch = 0
hw.vectorunit = 1
hw.busfrequency = 100000000
hw.cpufrequency = 3400000000
hw.cachelinesize = 64
hw.l1icachesize = 32768
hw.l1dcachesize = 32768
hw.l2settings = 1
hw.l2cachesize = 262144
hw.l3settings = 1
hw.l3cachesize = 8388608
hw.tbfrequency = 1000000000
hw.memsize = 17179869184
hw.availcpu = 8
sysctl -n hw.logicalcpu
8

Determine values of several system variables in the terminal in a Mac

I'm on a Mac. In the terminal, how would you figure out each of the following values?
Word size (64 bit vs. 32 bit)
L1/L2 cache size
Determine how much memory is being used (like df, but for RAM)
Thanks! I know you can find these in Activity Monitor, System Profiler etc. but I am trying to boost my knowledge of the terminal, and UNIX.
System Profiler is a GUI wrapper around /usr/sbin/system_profiler.
mress:10008 Z$ system_profiler -listDataTypes
Available Datatypes:
SPHardwareDataType
SPNetworkDataType
SPSoftwareDataType
SPParallelATADataType
SPAudioDataType
SPBluetoothDataType
SPCardReaderDataType
SPDiagnosticsDataType
SPDiscBurningDataType
SPEthernetDataType
SPFibreChannelDataType
SPFireWireDataType
SPDisplaysDataType
SPHardwareRAIDDataType
SPMemoryDataType
SPPCIDataType
SPParallelSCSIDataType
SPPowerDataType
SPPrintersDataType
SPSASDataType
SPSerialATADataType
SPUSBDataType
SPAirPortDataType
SPFirewallDataType
SPNetworkLocationDataType
SPModemDataType
SPNetworkVolumeDataType
SPWWANDataType
SPApplicationsDataType
SPDeveloperToolsDataType
SPExtensionsDataType
SPFontsDataType
SPFrameworksDataType
SPLogsDataType
SPManagedClientDataType
SPPrefPaneDataType
SPStartupItemDataType
SPSyncServicesDataType
SPUniversalAccessDataType
mress:10009 Z$ system_profiler SPHardwareDataType
Hardware:
Hardware Overview:
Model Name: iMac
Model Identifier: iMac10,1
Processor Name: Intel Core 2 Duo
Processor Speed: 3.33 GHz
Number Of Processors: 1
Total Number Of Cores: 2
L2 Cache: 6 MB
Memory: 16 GB
Bus Speed: 1.33 GHz
Boot ROM Version: IM101.00CC.B00
SMC Version (system): 1.52f9
Serial Number (system): QP0241DXB9S
Hardware UUID: 01C6B9E9-B0CB-5249-8AC7-069A3E44A188
You can also get some useful information from /usr/sbin/sysctl (try sysctl -a).
mress:10014 Z$ sudo sysctl -a | grep cache
Password:
hw.cachelinesize = 64
hw.l1icachesize = 32768
hw.l1dcachesize = 32768
hw.l2cachesize = 6291456
kern.flush_cache_on_write: 0
vfs.generic.nfs.client.access_cache_timeout: 60
vfs.generic.nfs.server.reqcache_size: 64
net.inet.ip.rtmaxcache: 128
net.inet6.ip6.rtmaxcache: 128
hw.cacheconfig: 2 1 2 0 0 0 0 0 0 0
hw.cachesize: 17179869184 32768 6291456 0 0 0 0 0 0 0
hw.cachelinesize: 64
hw.l1icachesize: 32768
hw.l1dcachesize: 32768
hw.l2cachesize: 6291456
machdep.cpu.cache.linesize: 64
machdep.cpu.cache.L2_associativity: 8
machdep.cpu.cache.size: 6144

Resources