User Tools

Site Tools


storage:smr

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
storage:smr [2024/02/14 14:05] – [Shingled magnetic recording (SMR)] Jan Formanstorage:smr [2024/02/16 09:40] Jan Forman
Line 13: Line 13:
 <code> <code>
 mkfs.f2fs -fm /dev/sda1 mkfs.f2fs -fm /dev/sda1
-mount -t f2fs -onoinline_data,noatime,flush_merge,no_heap,extent_cache,noacl,active_logs=2 /dev/sda1 /mnt+mount -t f2fs -onoinline_data,discard,noatime,flush_merge,no_heap,extent_cache,noacl,active_logs=2 /dev/sda1 /mnt
 </code> </code>
 +
 +
 +==== Timeout corrections for SMR drive ====
 +<code>
 +#!/bin/bash
 +
 +# source:
 +# https://www.reddit.com/r/linuxquestions/comments/lhl03r/ext4_or_btrfs_filesystem_on_smr_drive/
 +# https://unix.stackexchange.com/questions/541463/how-to-prevent-disk-i-o-timeouts-which-cause-disks-to-disconnect-and-data-corrup
 +
 +smr_fix() {
 +    DEVICE=`echo "$1" | cut -f3 -d/`
 +    #echo $DEVICE
 +    echo 3600 > /sys/block/$DEVICE/device/timeout
 +    echo 3600 > /sys/block/$DEVICE/device/eh_timeout
 +    echo none > /sys/block/$DEVICE/queue/scheduler
 +    echo 1 > /sys/block/$DEVICE/device/queue_depth
 +    echo 4 > /sys/block/$DEVICE/queue/nr_requests
 +}
 +
 +drives=`ls /dev/sd*[a-z]`
 +
 +for path in $drives
 +do
 +
 +    # model=`hdparm -i "$path" | grep -oe 'Model=[^,]*' | cut -f2 -d=`
 +    # model=`hdparm -I "$path" | grep Model\ Number: | cut -f2 -d: | sed 's/ //g'`
 +    model=`smartctl -i "$path" | grep -Ee 'Product|Device Model' | cut -f2 -d: | sed 's/ //g'`
 +
 +    case "$model" in
 +        ST4000LM024-2AN17V)
 +            smr=1
 +            ;;
 +        ST5000LM000-2AN170)
 +            smr=1
 +            ;;
 +        *)
 +            smr=0
 +            ;;
 +    esac
 +
 +    # echo "$path = $model = smr: $smr"
 +
 +    if [ $smr -eq 1 ]
 +    then
 +        echo "SMR drive $model @ $path"
 +        smr_fix "$path"
 +    fi
 +
 +done
 +</code>
 +
 +
 +
storage/smr.txt · Last modified: 2024/02/21 08:47 by Jan Forman