brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: blockdev --getsz checks if a replacement disk is big enough before a rebuild

Unraid
~/tips/tip-unraid-blockdev-getsz-replacement

blockdev --getsz /dev/sdX

Compare sector counts of the old and new disk before you start an array rebuild.

Two disks with the same number on the label are not always the same size to the sector. When you replace a failed array disk, Unraid cares about the real size, and finding out halfway through is annoying.

The command line page in the Unraid docs has a tool for exactly this check:

blockdev --getsz /dev/sdX

It returns the raw number of 512 byte sectors on a device. The docs call it handy for confirming that a replacement drive is large enough before rebuilding.

Find the device names in the Main tab, where every disk has its three letter sdX label. Then run it on the old disk and the new one and compare:

blockdev --getsz /dev/sdc
blockdev --getsz /dev/sdf

If the number for the new disk is the same or higher, you are fine. If it is lower, even by a little, it is not a straight swap for that slot, label or no label.

The same page also has fdisk -l /dev/sdX, which shows the partition layout and sizes and is meant for troubleshooting mismatched disk sizes when replacing disks. I’d use blockdev for the yes or no question and fdisk when you want to see why.

The caveat is that you are typing device names as root. blockdev --getsz only reads, but check twice which letter belongs to which disk before you go on to anything that writes. A wrong letter is the classic way to ruin a good afternoon.

Further reading: Unraid docs: Command line interface

Going deeper: Get the most out of Unraid: the settings worth changing, from shares to backups

More Unraid tips Change the RAID profile of a Unraid BTRFS pool with Balance Replace a disk in a redundant Unraid pool from the Main tab Test every Unraid drive with the DiskSpeed container See the XML behind a VM with the inline XML view in Unraid 7 Choose where a new VM's disk image is created with Unraid's storage override All Unraid tips (77) All topics

Link