Category Archives: Hardware

Reformat EMC Hard Drives to use in other systems – 520 to 512 Block Size Conversion – Solved

You can buy drives that came from EMC storage arrays such as the VNX off eBay for dirt cheap these days.

You can find Seagate and Hitachi/HGST variants such as the HGST 2TB 7.2K SAS Server Hard Drive HUS723020ALS640 0B26315 3.5″ that run at 6GB/s for about $25 shipped. You can also find enterprise SSDs and drives from other manufacturers that have a non-standard format applied as well. Note that these are typically true SAS drives and the connector is different from your average computer’s SATA interfaces. That being said, these are enterprise grade drives which means that they will typically last much longer than consumer grade drives.

There’s one little problem… EMC formats these drives with a Block size of 520, which is incompatible with most systems. Fortunately, you can do a Hard Drive Block Size Conversion.

The easiest way to fix these is in a server running Ubuntu with a SAS HBA that can pass the hard drive straight through.

First, install a couple tools:
sudo apt install curl
sudo curl -O http://sg.danny.cz/sg/p/libsgutils2-2_1.44-0.1_amd64.deb
sudo curl -O http://sg.danny.cz/sg/p/sg3-utils_1.44-0.1_amd64.deb
sudo dpkg -i libsgutils2-2_1.44-0.1_amd64.deb
sudo dpkg -i sg3-utils_1.44-0.1_amd64.deb

This will install sg3_utils – otherwise known as The Linux SCSI Generic (sg) Driver. You can read more and find other versions here.

Once installed, the next three commands will help you find and fix the block size.

List SCSI disks in Ubuntu. You will need the /dev/sgX location of the drive in the next step when you go to check the block size then format it.
sudo sg_scan -i

Get the current block size of a hard drive or SSD in Ubuntu!
sudo sg_readcap /dev/sg2

Format the drive to the correct block size / block length:
sudo sg_format --format --size=512 /dev/sg2

Once it’s finished, verify the block size:
sudo sg_readcap /dev/sg2

^^ This is all that has to be done. You can now shut down, move the drive to another system and it should work fine. With a properly configured system, you can do this hot while it is running as well, but do this at your own risk.

Additional info:

Get a hard drive or SSD’s serial number:
udevadm info --query=all --name=/dev/sda | grep SERIAL

Note that ID_SCSI_SERIAL will typically be the SN printed on the drive and the two other ID_SERIAL outputs should match the WWN of the drive.

Other partially useful commands:
sudo sg_get_config /dev/sg2
sudo sg_inq /dev/sg2
sudo sg_inq -e /dev/sg2
sudo sg_vpd /dev/sg2
sudo sg_vpd --page=bdc /dev/sg2
sudo sg_get_lba_status /dev/sg2

Another tool I like to install:
sudo apt install lsscsi

This will quickly list the attached drives (and SAS expanders)
lsscsi -l

If you’d like to see some output, this is what it will look like:

Continue reading Reformat EMC Hard Drives to use in other systems – 520 to 512 Block Size Conversion – Solved