3

I am setting block device read ahead buffer size like so:

blockdev --setra 8192 /dev/sda

As suggested here. The problem is after restart it goes back to 256 (default). I need it to retain the value i set it to. How can i do this? I'm on Ubuntu 16.04 x64.

3

You need to arrange to have the command run at boot time.

In the past, you could do this by placing it in the file /etc/rc.local. You can still do this, if you wish. Just create the file (as it does not exist by default anymore) and it will be run on next boot.


You can also simply create a new systemd oneshot unit which runs your desired command at boot time. For example:

[Unit]
Description=Set readahead for the hard drive device
After=local-fs.target

[Service]
Type=oneshot
ExecStart=/sbin/blockdev --setra 8192 /dev/sda

[Install]
WantedBy=multi-user.target

You might use this latter method if you expect admins of this server to not be familiar with the old rc.local script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.