when add new disk
myparted <dev> <serial>
mkdir /mnt/data-<serial>
myparted sdh 39C4
- get blkid PARTUUID
- add to /etc/fstab
.bashrc
alias mkfslazy='mkfs.ext4 -E lazy_itable_init=1'
myparted(){
[ "X$1" == "X" ] && echo "no args. need /dev/???" && return
[ "X$2" == "X" ] && echo "no args. need serial. hdinfo" && return
bestalignment=$(devbestalignment $1)
parted -a optimal --script /dev/$1 mklabel gpt mkpart $2 "${bestalignment}s" 100%
}
alias hdinfo='lshw -class disk | grep "logical name" -A2'
alias duf2='duf --hide-fs tmpfs,devtmpfs,squashfs'
devbestalignment(){
dev=$1
optimal_io_size=$(cat /sys/block/$dev/queue/optimal_io_size)
minimum_io_size=$(cat /sys/block/$dev/queue/minimum_io_size)
alignment_offset=$(cat /sys/block/$dev/alignment_offset)
physical_block_size=$(cat /sys/block/$dev/queue/physical_block_size)
if [ "$2" == "-v" ]; then
echo "optimal_io_size $optimal_io_size"
echo "minimum_io_size $minimum_io_size"
echo "alignment_offset $alignment_offset"
echo "physical_block_size $physical_block_size"
fi
val=$(echo "($optimal_io_size+$alignment_offset)/$physical_block_size" | bc)
if [ $val -lt 2048 ]; then
val=2048
fi
echo $val
}