How to use fdisk to overprovision an SSD drive

The Aerospike Knowledge Base has moved to https://support.aerospike.com. Content on https://discuss.aerospike.com is being migrated to either https://support.aerospike.com or https://docs.aerospike.com. Maintenance on articles stored in this repository ceased on December 31st 2022 and this article may be stale. If you have any questions, please do not hesitate to raise a case via https://support.aerospike.com.

Synopsis:

You may need to overprovision the SSD drive so that it works properly with Aerospike. Overprovisioning defines a partition on the drive. The partition does not consume all available area on the drive. We recommend that you plan to use 79% of the drive space for Aerospike, and that you allow 21% for overprovisioning.

If you connect the drives directly to the motherboard, you should be able to use hdparm to format the drive. If you use a RAID card, and it allows low-level access to the drive, you can use hdparm.

If the RAID controller does not allow low-level access to the drive, you can use fdisk to overprovision the drive. fdisk is a Linux tool for manipulating partition tables on drives. We can use it to overpartition SSD drives that are less than two TB in size.

  1. Use sudo to run fdisk and include the device to partition. In this case, we are partitioning /dev/sdb:

$root@LAB_TEST_SYSTEM: /etc/aerospike:root@LAB_TEST_SYSTEM:/etc/aerospike# sudo fdisk /dev/sdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0xce67d519. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won’t be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

The device presents a logical sector size that is smaller than the physical sector size. Aligning to a physical sector (or optimal I/O) size boundary is recommended, or performance may be impacted.

2. Enter ‘p’ to display the partition table:

Command (m for help): p

Disk /dev/sdb: 480.1 GB, 480103981056 bytes 255 heads, 63 sectors/track, 58369 cylinders, total 937703088 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0xce67d519

Device Boot Start End Blocks Id System


3. Enter ‘n’ to create a new partition:

Command (m for help): n

Partition type:

p primary (0 primary, 0 extended, 4 free)

e extended


4. Enter ‘p’ to create a new primary partition:

Select (default p): p


5. Enter ‘1’ to create partition 1 on the drive:

Partition number (1-4, default 1): 1


6. Provide the first sector for the partition. In this case, we use the default of 2048:

First sector (2048-937703087, default 2048):

Using default value 2048


7. Provide the last sector for the partition.  We are overprovisioning the drive to provide extra room for the drive to move data around. We are formatting the drive to use 79% of the storage on the drive for Aerospike, and allowing 21% for overprovisioning. In this case, the last sector of the drive is 937703087.  79% of that value is 740785438.

Last sector, +sectors or +size{K,M,G} (2048-937703087, default 937703087): 740785438


8. Enter ‘p’ to begin partitioning:

Command (m for help): p

Disk /dev/sdb: 480.1 GB, 480103981056 bytes

255 heads, 63 sectors/track, 58369 cylinders, total 937703088 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk identifier: 0xce67d519

Device Boot Start End Blocks Id System

/dev/sdb1 2048 740785438 370391695+ 83 Linux


9. Enter ‘w’ to write changes to the Master Boot Record (MBR):

Command (m for help): w

The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.


10. Run `lsblk` to list the block devices on the server.  We see a new partition under sdb, sdb1:

$root@LAB_TEST_SYSTEM: /etc/aerospikeroot@LAB_TEST_SYSTEM:/etc/aerospike# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

sda 8:0 0 447.1G 0 disk

├─ sda1 8:1 0 353.2G 0 part

sdb 8:16 0 447.1G 0 disk

├─ sdb1 8:17 0 353.2G 0 part

sdc 8:32 0 447.1G 0 disk

sdd 8:48 0 447.1G 0 disk

sde 8:64 0 447.1G 0 disk

sdf 8:80 0 447.1G 0 disk

sdg 8:96 0 278.9G 0 disk

├─ sdg1 8:97 0 243M 0 part /boot

├─ sdg2 8:98 0 1K 0 part

├─ sdg5 8:101 0 278.7G 0 part

├─ LAB_TEST_SYSTEM -root (dm-0) 252:0 0 22.7G 0 lvm /

├─ LAB_TEST_SYSTEM -swap_1 (dm-1) 252:1 0 256G 0 lvm [SWAP]

sr0 11:0 1 1024M 0 rom