AWS Volumes Setup

The bitcoin-data folder will contain the logs, blocks, UTXO set (stored in chainstate) and various other files the SV Node needs to function. For mainnet this folder will get very big, around 350GB for the UTXO set and 12TB for the blocks as of January 2024. The UTXO set is used for lookups to validate transactions and should be stored on a high-performant SSD. Depending on your use case, the blocks can be stored on slower, cheaper HDD storage.

If setting up the node in AWS, the recommendation is to use an instance type with strong single threaded performance like r7i and mount 1 or more EBS volumes of sc1 type for the bitcoin-data/blocks folder and use an EBS mounted io2 for the bitcoin-data folder including the chainstate.

For the blocks mount, it is recommended to use LVM to get around the AWS limitation of 16TB per volume, this will be needed as the blocks folder will continue to grow over time.

For io2 be mindful of the pricing: a 500GB disk with 3000 IOPS is $260 per month, a 500GB disk with 64000 IOPS is $3600 per month. 3000 IOPS should suffice, the main advantage io2 will bring is improved latency.

Installation

These commands assume the larger, slower storage is at /dev/nvme1n1 and the fast storage is at /dev/nvme2n1

Step 1: Install LVM2

sudo apt-get update
sudo apt-get install lvm2

Step 2: Prepare Physical Volume

Create LVM physical volumes the slower storage:

sudo pvcreate /dev/nvme1n1

Step 3: Create a Volume Group

Create a volume group including the relevant devices:

sudo vgcreate vg0 /dev/nvme1n1
sudo lvcreate -l 100%FREE -n lv_data vg0 /dev/nvme1n1

Step 4: Format and Mount the Logical Volume

Format the cached logical volume and mount it:

sudo mkfs.ext4 /dev/vg0/lv_data
sudo mkdir /mnt/bitcoin-blocks
sudo mount /dev/vg0/lv_data /mnt/bitcoin-blocks

Step 5: Format and Mount the SSD volume

Format the SSD volume and mount it:

sudo mkfs.ext4 /dev/nvme2n1
sudo mkdir /mnt/bitcoin-data
sudo mount /dev/nvme2n1 /mnt/bitcoin-data
ln -s /mnt/bitcoin-data ~/bitcoin-data
ln -s /mnt/bitcoin-blocks ~/bitcoin-data/blocks

Step 7: Automount on Startup

Edit /etc/fstab to automount the logical volume on startup:

  1. Get the UUID:

    sudo blkid /dev/vg0/lv_data
    sudo blkid /dev/nvme2n1
  2. Add to /etc/fstab (replace <your-UUID> with the actual UUIDs):

    UUID="<your-UUID-of-vg0>" /mnt/bitcoin-blocks ext4 defaults 0 2
    UUID="<your-UUID-of-nvme2n1>" /mnt/bitcoin-data ext4 defaults 0 2

Step 9: Testing the Configuration

Reboot your system and test the configuration:

sudo reboot

After rebooting, verify the setup:

sudo df -h
sudo mount | grep bitcoin-blocks
sudo mount | grep bitcoin-data
sudo lvdisplay
# Expected output
#  --- Logical volume ---
#  LV Path                /dev/vg0/lv_data
#  LV Status              available
#  LV Size                <16.00 TiB
#  ...

Last updated