Skip to main content
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Source Link

Just unmount it: umount /proc/meminfo

All those programs (free, top, atop, etc.) have to get their information from somewhere. And that somewhere is /proc/meminfo.

If you want to provide fake information for one program, run it in a mount namespace:

$ unshare -m bash
$$ mount --bind … /proc/meminfo
$$ myprogram

If you want to lie only about the swap space, make the fake meminfo file a dynamic file via a FUSE filesystemdynamic file via a FUSE filesystem. (Note: a named pipe also works, but only if it's accessed by a single program at a time.)

Just unmount it: umount /proc/meminfo

All those programs (free, top, atop, etc.) have to get their information from somewhere. And that somewhere is /proc/meminfo.

If you want to provide fake information for one program, run it in a mount namespace:

$ unshare -m bash
$$ mount --bind … /proc/meminfo
$$ myprogram

If you want to lie only about the swap space, make the fake meminfo file a dynamic file via a FUSE filesystem. (Note: a named pipe also works, but only if it's accessed by a single program at a time.)

Just unmount it: umount /proc/meminfo

All those programs (free, top, atop, etc.) have to get their information from somewhere. And that somewhere is /proc/meminfo.

If you want to provide fake information for one program, run it in a mount namespace:

$ unshare -m bash
$$ mount --bind … /proc/meminfo
$$ myprogram

If you want to lie only about the swap space, make the fake meminfo file a dynamic file via a FUSE filesystem. (Note: a named pipe also works, but only if it's accessed by a single program at a time.)

Source Link
Gilles 'SO- stop being evil'
  • 865.3k
  • 205
  • 1.8k
  • 2.3k

Just unmount it: umount /proc/meminfo

All those programs (free, top, atop, etc.) have to get their information from somewhere. And that somewhere is /proc/meminfo.

If you want to provide fake information for one program, run it in a mount namespace:

$ unshare -m bash
$$ mount --bind … /proc/meminfo
$$ myprogram

If you want to lie only about the swap space, make the fake meminfo file a dynamic file via a FUSE filesystem. (Note: a named pipe also works, but only if it's accessed by a single program at a time.)