You are not logged in.

#1 2013-08-25 14:53:35

rep_movsd
Member
Registered: 2013-08-24
Posts: 142

blockdev settings do not persist after filesystem remounts

I am trying to set blockdev readahead

I made a systemd service as follows :

[Unit]
Description=Set blockdev readahead
DefaultDependencies=no
After=local-fs.target
Wants=local-fs.target
ConditionPathExists=/etc/setblockdev.sh

[Service]
Type=forking
RemainAfterExit=no
ExecStart=/etc/setblockdev.sh

[Install]
WantedBy=multi-user.target

This launches this script :

#!/bin/bash
echo Setting Block device readahead...
blockdev --setra 262144 /dev/md1
blockdev --setra 262144 /dev/md0
blockdev --report > /tmp/blockdev
exit 0

On bootup I can see the /tmp/blockdev file contain the right values, however blockdev --report shows it has defaulted back to 256.

It seems like when the kernel remounts the file system, it reverts back :

[    8.365194] archaic kernel: EXT4-fs (md1): re-mounted. Opts: discard,stripe=256,data=writeback,nobarrier,inode_readahead_blks=256,delalloc,commit=0
[    8.368687] archaic kernel: EXT4-fs (md0): re-mounted. Opts: discard,stripe=1024,data=writeback,commit=0

How do I ensure blockdev readahead is set and retained as early as possible in the boot process?

Offline

Board footer

Powered by FluxBB