Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an existing RAID Array and I want to increase the readahead setting. But the device has already been formatted and contains data that I cannot afford to lose. I'm unfamiliar with the blockdev command. Is it safe to run blockdev --setra=xxxxx on devices that have already been formatted? Will running the following command destroy (delete) the data on my device? Is there any risk of this happening?

$ blockdev --setra 65536 /dev/md0

Not sure this is important, but here are the devices details:

$ xfs_info /data/d1

meta-data=/dev/md0               isize=256    agcount=16, agsize=8191936 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=131070976, imaxpct=25
         =                       sunit=64     swidth=256 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=64000, version=2
         =                       sectsz=512   sunit=64 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

$ sudo mdadm --detail /dev/md0
        Version : 1.2
  Creation Time : Thu May  5 17:23:35 2011
     Raid Level : raid0
     Array Size : 524283904 (500.00 GiB 536.87 GB)
   Raid Devices : 4
  Total Devices : 4
    Persistence : Superblock is persistent

    Update Time : Thu May  5 17:23:35 2011
          State : clean
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0

     Chunk Size : 256K

           Name : d1:0
           UUID : 16d7fee4:a8903d2f:28c65d2f:161006b5
         Events : 0

    Number   Major   Minor   RaidDevice State
       0     202      241        0      active sync   /dev/sdp1
       1     202      242        1      active sync   /dev/sdp2
       2     202      243        2      active sync   /dev/sdp3
       3     202      244        3      active sync   /dev/sdp4
share|improve this question

"blockdev --setra" is perfectly safe. We have it in our init scripts to run on every boot on a couple of servers. You probably want to do the same after you have benchmarked a few values and decided which is best for your workload.

share|improve this answer
thanks for the help! – AlanZ May 10 '11 at 19:28

I've run blockdev --setra XX on many existing file systems with data without experiencing data loss. In fact, it's a runtime setting so if you want a non-default read ahead setting to be persistent, you need to --setra on the block device at every boot.

share|improve this answer
thanks for the help! – AlanZ May 10 '11 at 19:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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