User Tools

Site Tools


Action disabled: revisions
storage:smr

Shingled magnetic recording (SMR)

Acceptable storage systems: F2FS, exFAT, CEPH, RAID1
Unacceptable: RAID 5 etc, NTFS, Ext4, …

How to format 8TB SMR Drive

mkfs.f2fs -s64 -o0 -t0 -a0 /dev/sda1
mount -t f2fs -onoinline_data,noatime,flush_merge,no_heap,extent_cache,noacl,active_logs=2 /dev/sda1 /mnt


or if this drive identify as a host-aware zoned device

mkfs.f2fs -fm /dev/sda1
mount -t f2fs -onoinline_data,discard,noatime,flush_merge,no_heap,extent_cache,noacl,active_logs=2 /dev/sda1 /mnt

Timeout corrections for SMR drive

#!/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
storage/smr.txt · Last modified: 2024/02/21 08:47 by Jan Forman