DEV Community

Emanuel Cascone
Emanuel Cascone

Posted on • Edited on

Turn Your Hard Drives Into Super SSDs: The Ultimate Guide to RAID 0 and LVM Mastery

Some cryptocurrencies use hard drives (HDDs) for mining — yes, it’s strange, but it happens! And they need speed to do so. So, if you’re a miner or need a super-fast SSD, this article is here to help you achieve that.

Maximizing HDD Performance to Match SSD Speeds

In this article, I’ll guide you through the best methods to get the most out of your HDDs, boosting their performance to match that of an SSD while maintaining a higher gigabyte count.

To achieve this, we’ll use a concept known as RAID 0 and create a hierarchy of LVMs (Logical Volume Managers).

Understanding RAID 0 and LVM: The Secrets to Speed

RAID 0 is a technique that distributes files in interleaved blocks across each HDD. This setup enables you to combine the speeds of multiple HDDs to achieve the total read and write speed of the blocks. The image below illustrates how blocks are organized:

RAID Block Example

On the other hand, LVM (Logical Volume Manager) serves the primary function of creating logical volumes, which tells your operating system that a cluster of disks forms a single unified volume.

If your HDDs have different speeds, don’t worry! Keep reading for tips on how to handle that.

Let’s Set Up a 256GB Environment for Everyday Tasks

Now that we understand the terms above, let’s create an environment that is just the right size for everyday tasks. I believe 256GB should be sufficient.

Once you have the necessary packages installed (lvm2), you can start setting up your system.

Testing HDD Speeds and Sorting Them by Performance

The first step is to test the speeds of the HDDs you’ll be using. If any of your drives are twice as fast as the others, separate them — I’ll explain what to do with them later.

After sorting the drives into groups based on their speeds, create partitions as described and use the following commands to create an LVM:

# pvcreate /dev/[pathToHDD1] /dev/[pathToHDD2] ...
# vgcreate [groupName] /dev/[pathToHDD1] /dev/[pathToHDD2] ...
# lvcreate --type raid0 -L [LVMsize] --stripes [numberOfSlowerHDDs] --stripesize [blockSize] -n [LVMname] [groupName]
# mkfs.ext4 /dev/[groupName]/[LVMname]
Enter fullscreen mode Exit fullscreen mode
  • pvcreate creates physical labels.
  • vgcreate creates partition groups.
  • lvcreate creates the logical disk.
  • mkfs.ext4 formats the disk with the ext4 filesystem.

Calculating Block Sizes and Creating a Speed Hierarchy

To determine the optimal block size and LVM setup, consider the number and speed of the available HDDs. RAID 0 typically operates at the speed of the slowest HDD, meaning the average read/write speed is the result of multiplying the slowest HDD speed by the number of HDDs in the LVM (SpeedHDD × NumberOfHDDs = LVM Speed).

Here’s how we can create an efficient hierarchy of LVMs:

Let’s assume we have HD1, HD1, HD1, HD1, HD2, HD2, where HD2 is twice as fast as HD1. We can set up the following:

  • LVM1 = (HD1 + HD1 + HD1 + HD1) = 4 × speedHD1
  • LVM2 = (HD2 + HD2) = 4 × speedHD1
  • LVMMaster = LVM1 + LVM2 = 8 × speedHD1

Partitioning and Block Size Considerations

For RAID 0 to work properly, make sure that each HDD is partitioned according to the group it will belong to so that LVMMaster totals 256GB. The HDD in each group should be partitioned such that its respective LVM is half the size of the LVMMaster.

Also, it’s crucial to select a block size of 256 for all LVMs, as plotting files tend to be large.

Bonus Tip: Boost Your LVM with USB Drives

An added benefit of this setup is that you can even use USB drives, which can further increase the speed of your LVM, making it comparable to SSD speeds!

Need Help? Let Me Know in the Comments!

If you have any doubts, feel free to ask in the comments. I’ll be happy to assist! 😬


This translation and enhancement should help engage your audience while delivering the technical content in an appealing and easily understandable way!

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more