I recently picked up a batch of enterprise-grade EMC SAS hard drives off eBay for a homelab storage project. They were dirt cheap and came from a decommissioned EMC storage array. I slotted them into a JBOD (KTN-STL3 enclosure) and connected it to a Linux server running Proxmox – but quickly hit a wall.
The drives showed up in lsblk, but with 0B capacity. At first, I thought they were dead. Turns out, it was a classic enterprise storage “gotcha.”
These drives were formatted with 520-byte sectors, instead of the standard 512 bytes used by most consumer and server operating systems. The extra 8 bytes per sector are used by EMC arrays for metadata and checksums – but outside of that environment, Linux can’t use them by default.
Reformatting to 512 byte Sectors
Using the sg3_utils package on Linux, I was able to identify the issue and fix it with a simple reformat:
sudo sg_format --format --size=512 /dev/sdX
Since I had multiple drives to reformat, I wrote a bash script with the help of ChatGPT to find all drives with 520 byte sectors and reformat them in parallel. It saved me a ton of time and effort – and now I’ve got a stack of 3TB drives working perfectly in my ZFS pool for cheap.
#!/bin/bash
# Find all /dev/sdX drives
DRIVES=$(lsblk -dn -o NAME,TYPE | awk '$2 == "disk" {print "/dev/" $1}')
# Identify drives with 520-byte sectors
echo "Scanning for drives with 520-byte sectors..."
TARGET_DRIVES=()
for DRIVE in $DRIVES; do
BLOCK_SIZE=$(sg_format -v "$DRIVE" 2>/dev/null | grep 'block size=' | awk -F= '{print $2}' | awk '{print $1}')
if [[ "$BLOCK_SIZE" == "520" ]]; then
TARGET_DRIVES+=("$DRIVE")
fi
done
# If none found, exit
if [[ ${#TARGET_DRIVES[@]} -eq 0 ]]; then
echo "No drives with 520-byte sectors found. Exiting."
exit 0
fi
# Display list
echo " The following drives have 520-byte sectors and will be reformatted to 512:"
for d in "${TARGET_DRIVES[@]}"; do
echo " - $d"
done
# Prompt confirmation
read -p "Are you SURE you want to format these drives? This is destructive! (yes/no): " CONFIRM
if [[ "$CONFIRM" != "yes" ]]; then
echo "Aborted."
exit 1
fi
# Format in parallel
echo "Starting reformatting..."
for d in "${TARGET_DRIVES[@]}"; do
(
echo "⏳ Formatting $d ..."
sg_format --format --size=512 "$d" && echo "Done with $d" || echo "Failed to format $d"
) &
done
wait
echo " All formatting operations complete."