✓ Solved

How do I put multiple "disks" on a Block Storage volume?

Linode Staff

Compute Instances are limited to a total if eight root block devices through the Cloud Manager (Local Disks and Block Storage Volumes). i.e. /dev/sda through /dev/sdh.

Note: More than 8 Block Storage volumes may be configured using the API if a Compute Instance has 16GB of RAM or more, with the number of volumes that can be attached being equal to the number of GB of RAM that the instance has.

If I don't want to use the API, how can I get multiple "disks" on one volume?

1 Reply

✓ Best Answer

Partitioned Block Storage Volumes

This can be done via fdisk. Instead of following the provided Volume Configuration in the Cloud Manager when you create a new volume do the following:

First, you will want to create a partition map: WARNING: This will erase the entire volume.

  • Go to your Linode's Configuration Tab and determine the block device your Block Storage volume is assigned to. This should typically be /dev/sdc which I will use in my examples.

  • To get started with a new volume, you’ll want to create a partition map on it:

root@localhost:~# fdisk /dev/sdc
[...]
Command (m for help): g
Created a new GPT disklabel (GUID: FD06AACE-5487-344F-89EB-75794A73521C).

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
  • Next you will want to want to create the individual partitions. (I am creating two partitions of ~50GB on a 100GB volume in this example):
root@localhost:~# fdisk /dev/sdc
[...]
Command (m for help): n
Partition number (1-128, default 1): 1
First sector (2048-209715166, default 2048): 2048
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-209715166, default 209715166): +50G

Created a new partition 1 of type 'Linux filesystem' and of size 50 GiB.

Command (m for help): n
Partition number (2-128, default 2): 2
First sector (104859648-209715166, default 104859648): 104859648
Last sector, +/-sectors or +/-size{K,M,G,T,P} (104859648-209715166, default 209715166): 209715166

Created a new partition 2 of type 'Linux filesystem' and of size 50 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
  • You will now want to create a filesystem on each partition. This differs from the ususal method by adding "-part###" at the end of the Cloud Manager provided volume configuration.
root@localhost:~# mkfs.ext4 "/dev/disk/by-id/scsi-0Linode_Volume_MultiVolume-part1"
mke2fs 1.46.2 (28-Feb-2021)
Discarding device blocks: done
Creating filesystem with 13107200 4k blocks and 3276800 inodes
Filesystem UUID: 414d5104-1315-40ff-9375-037f9ad022d7
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
    4096000, 7962624, 11239424

Allocating group tables: done
Writing inode tables: done
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done

root@localhost:~# mkfs.ext4 "/dev/disk/by-id/scsi-0Linode_Volume_MultiVolume-part2"
mke2fs 1.46.2 (28-Feb-2021)
Discarding device blocks: done
Creating filesystem with 13106939 4k blocks and 3276800 inodes
Filesystem UUID: d95bc163-0d3c-42e8-903b-dd301a2fbc38
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
    4096000, 7962624, 11239424

Allocating group tables: done
Writing inode tables: done
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done
  • You can now create mount points for your partitions (you can call them whatever you want, just make sure to use the same path in the rest of the examples if you do.):
root@localhost:~# mkdir "/mnt/MultiVolume-part1"
root@localhost:~# mkdir "/mnt/MultiVolume-part2"
  • Then you can mount the new partitions:
mount "/dev/disk/by-id/scsi-0Linode_Volume_MultiVolume-part1" "/mnt/MultiVolume-part1"
mount "/dev/disk/by-id/scsi-0Linode_Volume_MultiVolume-part1" "/mnt/MultiVolume-part1"
  • You can verify that everything works and is mounted:
root@localhost:~# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0 24.5G  0 disk /
sdb      8:16   0  512M  0 disk [SWAP]
sdc      8:32   0  100G  0 disk
??sdc1   8:33   0   50G  0 part /mnt/MultiVolume-part1
??sdc2   8:34   0   50G  0 part /mnt/MultiVolume-part2
  • If you want the partitions to automatically mount every time your Linode boots, you’ll want to add a line like the following to your /etc/fstab file for each of the partitions:
/dev/disk/by-id/scsi-0Linode_Volume_MultiVolume-part1 /mnt/MultiVolume-part1 ext4 defaults,noatime,nofail 0 2
/dev/disk/by-id/scsi-0Linode_Volume_MultiVolume-part2 /mnt/MultiVolume-part2 ext4 defaults,noatime,nofail 0 2

Restart your Linode and have fun!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct