To check reserved memory on an Ubuntu server using systemd, you can use the following methods:
cat /proc/meminfo: This command displays information about the system's memory usage, including the amount of reserved memory. Look for the MemReserved line, which shows the amount of memory reserved by the kernel.
sysctl -a | grep reserved: This command displays all sysctl variables related to memory, including the vm.reserved variable, which shows the amount of memory reserved by the kernel.
journalctl -u systemd: This command displays the systemd journal logs, which may contain information about memory reservations. You can filter the output using grep to search for specific keywords, such as "reserved" or "memory".
systemd-analyze memory: This command analyzes the system's memory usage and displays information about memory reservations, including the amount of memory reserved by the kernel.
Note that the MemReserved value in /proc/meminfo may not always reflect the actual amount of reserved memory, as it only accounts for memory reserved by the kernel's memory allocator. Other components, such as device drivers or firmware, may also reserve memory that is not reflected in this value.
To get a more detailed view of memory usage, you can use tools like smem or pmap, which can provide information about memory usage by individual processes and the kernel.
Example output of cat /proc/meminfo:
MemTotal: 16344972 kB
MemFree: 7451904 kB
MemAvailable: 11311340 kB
Buffers: 131072 kB
Cached: 2342912 kB
SwapCached: 0 kB
Active: 2342912 kB
Inactive: 131072 kB
Active(anon): 131072 kB
Inactive(anon): 65536 kB
Active(file): 2209920 kB
Inactive(file): 65536 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 16777216 kB
SwapFree: 16777216 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 131072 kB
Mapped: 2342912 kB
Shmem: 65536 kB
Slab: 1048576 kB
SReclaimable: 524288 kB
SUnreclaim: 524288 kB
KernelStack: 131072 kB
PageTables: 262144 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 24951024 kB
Committed_AS: 131072 kB
VmallocTotal: 34359738368 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
MemReserved: 1048576 kB
In this example, the MemReserved value is 1048576 kB (1 GB), which indicates that the kernel has reserved 1 GB of memory.