Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged

99

Improving disk cache performance in general is more than just increasing the file system cache size unless your whole system fits in RAM in which case you should use RAM drive (tmpfs is good because it allows falling back to disk if you need the RAM in some case) for runtime storage (and perhaps an initrd script to copy system from storage to RAM drive at ...


84

Shell Session Limit The limits set via ulimit only affects processes created by the current shell session. The "soft limit" is the actual limit that is used. It could be set, as far as it's not greater than the "hard limit". The "hard limit" could also be set, but only to a value less than the current one, and only to a value not less than the "soft ...


78

To make options such as this permanent you'll typically add them to the file /etc/sysctl.conf. You can see a full list of the options available using this command: $ sysctl -a Example $ sudo sysctl -a | head -5 kernel.sched_child_runs_first = 0 kernel.sched_min_granularity_ns = 6000000 kernel.sched_latency_ns = 18000000 kernel.sched_wakeup_granularity_ns =...


60

The ping command shows the address it resolved the name to. In this case it resolved to the IPv6 localhost address, ::1. On the other hand, 127.0.0.1 is an IPv4 address, so it explicitly makes ping use IPv4. The sysctl you used only affects IPv4 pings, so you get replies for ::1, but not for 127.0.0.1. The address you get from resolving localhost depends ...


34

I've found the answer while still writing the question. I've decided to post it anyway because others may find this insightful, and then answer it myself; I hope this is not frowned upon :) The user Philipp Matthias Hahn on the linux-kernel mailing list has figured it out at least partially: As far as I researched for IPv4 some time ago, the "default" ...


32

127.0.0.1: 127.0.0.1 is the default loopback of most system. A loopback address is an address used by the system to validate the network stack of the OS. The loopback address for IPv4 could take any value in the subnet 127.0.0.0/8 The loopback address for IPv6 could take any value in the subnet ::1/128 ping any value in those range should work if your ...


29

Checking the value of a sysctl variable is as easy as sysctl <variable name> and, by the way, setting a sysctl variable is as straightforward as sudo sysctl -w <variable name>=<value> but changes made this way will probably hold only till the next reboot. As to which of the config locations, /etc/sysctl.conf or /etc/sysctl.d/, takes ...


20

Sysctl settings are documented in Documentation/sysctl/*.txt in the kernel source tree. On Debian, install linux-doc to have the documentation in usr/share/doc/linux-doc-*/Documentation/ (most distributions have a similar package). From Documentation/sysctl/kernel.txt: The four values in printk denote: console_loglevel, default_message_loglevel, ...


17

So it was actually trivial, looking at the very last message from the bug report: Re: Bug#842226: dmesg: read kernel buffer failed: Operation not permitted Part of the changelog from the aforementioned kernel: * security,printk: Enable SECURITY_DMESG_RESTRICT, preventing non-root users reading the kernel log by default (sysctl: kernel....


16

Firstly, I DO NOT recommend you continue using NTFS, as ntfs implemention in Linux would be performance and security trouble at any time. There are several things you can do: use some newer fs such as ext4 or btrfs try to change your io scheduler, for example bfq turn off swap use some automatic preloader like preload use something like systemd to preload ...


13

I just wanted to add to this question as I was trying to disable transparent hugepages on CentOS v6 in order to enable TokuDB for MariaDB. I added the script mentioned by @slm to /etc/rc.local and it disabled transparent hugepages. However, because of the way startup scripts work in Linux, /etc/rc.local is executed after all the services are started. ...


11

It seems that creating the file /etc/launchd.conf and putting your command inside it should do the trick. If it does not work, you can probably edit or create the /etc/rc.local file and add your command inside it as there is little chance that Apple will ever delete support for limit on the command line. Edit 1: I should have start with that, the ...


11

You are redirecting the stderr of the grep to /dev/null but the stderr messages are coming from sysctl. Try sudo sysctl -a --ignore 2>/dev/null | grep -i max_map_count


10

I just added these two lines in my .bash_profile works like a charm ulimit -n 1024 ulimit -u 1024


10

Debian (and hence probably Ubuntu, too) has been known to ship a kernel with such a restriction of user_namespaces, and there the way to enable it was/is: sysctl -w kernel.unprivileged_userns_clone=1 (Source: https://blog.mister-muffin.de/2015/10/25/unshare-without-superuser-privileges/.) ALT has such a restriction in kernel-image-std-def, too. ...


9

Entries in procfs are managed by ad hoc code. The code that would set permissions and ownership on the files under /proc/sys (proc_sys_setattr) rejects changes of permissions and ownership with EPERM. So it isn't possible to change the permissions or ownership of these files, full stop. Such changes are not implemented, so being root doesn't help. When you ...


9

Localhost has two addresses, an IPv6 address ::1 and an IPv4 address 127.0.0.1. IPv6 is the default protocol, so ::1 is always preferred over 127.0.0.1. This is why you have pinged ::1 when asking to ping localhost. As for why you could ping ::1 but could not ping 127.0.0.1, your sysctl has only disabled pings for IPv4, but not for IPv6. As far as I can ...


8

You need to execute: sysctl -w net.ipv4.conf.all.arp_filter=1 This can be useful reading: Multiple network interfaces and ARP flux


8

Read ahead: On 32 bit systems: blockdev --setra 8388607 /dev/sda On 64 bit systems: blockdev --setra 4294967295 /dev/sda Write behind cache: echo 100 > /proc/sys/vm/dirty_ratio This will use up to 100% of your free memory as write cache. Or you can go all out and use tmpfs. This is only relevant if you have RAM enough. Put this in /etc/fstab. ...


8

System limits Changing the limits in /etc/launchd.conf or /etc/rc.local is no longer supported for the recent macOS. See: Old Systems and Technology. Instead, you should create a new launch agent. Here is the command example using PlistBuddy command (see: man PlistBuddy): sudo /usr/libexec/PlistBuddy /Library/LaunchAgents/com.launchd.maxfiles.plist \ -c "...


7

on Linux, you'd do something like sudo sysctl -w net.ipv4.ip_local_port_range="60000 61000" instruction for changing ephemeral port range on other unices can be found for example at http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html


7

The difference is the scope, and how it's applied. Open file limits set via sysctls apply to the entire system, whereas limits set via /etc/security/limits.conf apply only to things that meet the criteria specified there. The other primary difference is that /etc/security/limits.conf limits are applied via ulimit, and thus can be changed more readily, ...


7

I don’t think there is any such official documentation. sysctl entries are handled by procps and systemd; but neither projects’ documentation address how entries are processed within the same configuration file. The short version is that the last entry in sysctl.conf wins, even when other files are present (in /etc/sysctl.d or elsewhere), regardless of ...


6

You can set the read-ahead size with blockdev --setra sectors /dev/sda1, where sectors is the size you want in 512 byte sectors.


6

All of the above didn't work for me on an EC2 Ubuntu 16.04, but this did: sudo apt install hugepages sudo hugeadm --thp-never


6

Here's an implementation using puppet: exec { "disable_transparent_hugepage_enabled": command => "/bin/echo never > /sys/kernel/mm/transparent_hugepage/enabled", unless => "/bin/grep -c '\[never\]' /sys/kernel/mm/transparent_hugepage/enabled 2>/dev/null", } exec { "disable_transparent_hugepage_defrag": command => "/bin/echo never > ...


6

These are sysctl parameters. You can set them either by writing to /proc/sys/CATEGORY/ENTRY or by calling the sysctl command with the argumnent /proc/sys/CATEGORY/ENTRY=VALUE. These settings affect the running kernel, they are not persistent. If you want to make these settings persistent, you need to set them at boot time. On Ubuntu, create a file in the ...


6

So one of the big things about learning to Unix is reading the bloody man page: I'm not just being a get off my lawn grumpy old man, there REALLY IS valuable information in there. In this case: DESCRIPTION sysctl is used to modify kernel parameters at runtime. The parameters available are those listed under /proc/sys/. Procfs is ...


6

sysctl -w writes kernel parameter values to the corresponding keys under /proc/sys: sudo sysctl -w fs.inotify.max_user_watches=12288 writes 12288 to /proc/sys/fs/inotify/max_user_watches. (It’s not equivalent, it’s exactly that; interested readers can strace it to see for themselves.) sysctl -p loads settings from a file, either /etc/sysctl.conf (the ...


5

The handler for accept_ra in net/ipv6/addrconf.c is proc_dointvec. So generic interface code has previously generated an array of all and interface-specific entries, and writing into these with sysctl or procfs just puts the value you specify in the array. We are concerned with how those values are then used You'll see from callers of ipv6_accept_ra() ...


Only top voted, non community-wiki answers of a minimum length are eligible