How to Use Block Storage with Your Linode

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Create a Linode account to try this guide with a $100 credit.
This credit will be applied to any valid services used during your first 60 days.
Note
Our newer NVMe Block Storage solution is now available across most of our data centers. This new hardware dramatically increases the performance of Block Storage and is offered at no additional cost. Review the NVMe Block Storage Upgrade guide to learn more about this roll out.

Linode’s Block Storage service allows you to attach additional storage drives (called Volumes) to your Linode. Each Volume be partitioned however you like and can accommodate any file system type you choose. Additional pricing details as well as availability, features, and limits can be found on the Block Storage Overview product guide.

How to Add a Block Storage Volume to a Linode

This guide assumes a Linode with the root disk mounted as /dev/sda and swap space mounted as /dev/sdb. In this scenario, the Block Storage Volume will be available to the operating system as /dev/disk/by-id/scsi-0Linode_Volume_EXAMPLE, where EXAMPLE is a label you assign the Volume in the Linode Cloud Manager. Storage Volumes can be added when your Linode is already running, and will show immediately in /dev/disk/by-id/.

Note
A Linode can have multiple Block Storage Volumes attached to it. However, a Block Storage Volume can only be attached to one Linode at a time.

Add a Volume from the Linode Detail Page

Follow these steps to create a new Block Storage Volume, attach it to your Linode, create a filesystem, and mount your Volume.

Note
If the Linode’s data center has been upgraded to NVMe Block Storage and your Linode was deployed prior to August 24th, 2021, you may need to reboot your Linode for it to properly work with a NVMe Block Storage Volume.
  1. Log in to the Cloud Manager and click on the Linodes link in the sidebar.

  2. Select the Linode to which you want to attach a Block Storage Volume. The detail page for the Linode will appear.

  3. Navigate to the Storage tab and then click the Add a Volume button (within the Volumes section).

  4. Complete the Create a Volume form.

    • Select Create and Attach Volume to create a new Volume. Otherwise select Attach Existing Volume to attach a Volume that’s already on your account and in the same data center as the Linode.
    • Label: A string up to 32 characters long and consisting only of ASCII characters a-z; 0-9.-_.
    • Size: The desired size for the new Volume. See the Limits and Considerations section for the minimum and maximum size.
    • Config: If the Linode has multiple Configuration Profiles, select which one the Block Storage Volume should be assigned to.
    • Tags: Optionally add or assign tags to help label and organize your services.
  5. When finished, click Create Volume.

  6. A Volume Configuration panel appears, which contains the instructions needed to start using the new Volume with your Linode. These instructions include commands for creating the file system, mounting the Volume, and configuring your Linode to automatically mount the Volume at boot. To learn more about these commands, see Configuring and Mounting a Volume.

  7. Once created, the Volume is listed under the Volumes table.

Attach a Volume from Your Account’s Volume List

Follow these steps to attach an existing Block Storage Volume.

  1. Log in to the Cloud Manager and click on the Volumes link in the sidebar.

  2. Locate the desired Volume within the list, click the more options ellipsis dropdown menu, and select Attach.

  3. Complete the Attach Volume form that appears.

    • Linode: Use the dropdown menu to select the Linode you’d like to use. The Volume will be attached to this Linode.
    • Config: If the Linode has multiple Configuration Profiles, select which one the Block Storage Volume should be assigned to. This field will not be displayed if the Linode has only a single profile.
    Note
    The Linode must be located within the same data center as the Block Storage Volume.
    Note
    If the Linode’s data center has been upgraded to NVMe Block Storage and your Linode was deployed prior to August 24th, 2021, you may need to reboot your Linode for it to properly work with a NVMe Block Storage Volume.
  4. Click the Save button to attach the Volume.

  5. To start using the Volume on the Linode, additional internal configuration is required. This includes creating the file system (if the Volume hasn’t been used before), mounting the Volume, and configuring your Linode to automatically mount the Volume at boot. To learn more about these configuration steps, see Configuring and Mounting a Volume.

How to Detach a Block Storage Volume from a Linode

Follow these steps to safely detach a Block Storage Volume from a Linode. A Volume should be detached before it is reattached to a different Linode.

  1. Log in to the Cloud Manager and click on the Linodes link in the sidebar.

  2. Select the Linode that the Volume is currently attached to.

  3. It’s recommended to power off the Linode. To do this, click Power Off on the top right of the Linode details page.

    Caution

    If a volume is currently mounted, detaching it while the Linode is powered on could cause data loss or an unexpected reboot. You can unmount the volume for safe live-detaching using the umount command:

    umount /dev/disk/by-id/scsi-0Linode_Volume_BlockStorage1
    

    To avoid additional issues with your Linode, remove the detached volume’s line from your /etc/fstab/ configuration:

    FILE_SYSTEM_PATH /mnt/BlockStorage1 ext4 defaults 0 2

  4. Navigate to the Storage tab.

  5. Locate the Volume you wish to detach within the Volumes list, click the more options ellipsis dropdown menu, and select Detach.

  6. A confirmation screen appears and explains that the Volume will be detached from the Linode. Click Detach to confirm.

After detaching it from a Linode, the Volume will still exist on your account. It can be viewed within the Volumes listing page in the Cloud Manager.

How to Delete a Block Storage Volume

Follow these steps to delete a Block Storage Volume from the Cloud Manager.

Caution
Once a Block Storage Volume has been deleted, the data contained on that Volume will be permanently erased. This action cannot be reversed.
  1. Log in to the Cloud Manager.

  2. If the Volume is attached to a Linode, power off that Linode and detach the Volume. To do so, follow the instructions within the Detach the Volume guide.

  3. Click on the Volumes link in the sidebar.

  4. Locate the desired Volume within the list, click the more options ellipsis dropdown menu, and select Delete.

  5. In the configuration dialog, click Delete once again.

How to Resize a Block Storage Volume

At any time after the Block Storage Volume has been created, it can be increased to a larger size.

Note
At this time, the size of Volumes are only able to be increased (not decreased). To decrease the size of your Volume, you will need to create a new Volume at your preferred size, attach it to your Linode, copy over your data, and remove the original Volume.
  1. Log in to the Cloud Manager.

  2. If the Volume is attached to a Linode, power off that Linode.

  3. Click on the Volumes link in the sidebar.

  4. Locate the desired Volume within the list, click the more options ellipsis dropdown menu, and select Resize.

  5. Enter the new Volume size. The minimum size is the current size of the Volume and maximum is 10,000 GB. Then click Submit.

  6. Click Resize Volume to start the resize. Once clicked, the Resizing Instructions panel appears with the instructions and commands needed to resize the Volume’s filesystem. Either save these commands or leave this panel open. The notification bell in the top right of the page will notify you when the resizing is complete.

  7. Reboot your Linode after the Volume is resized.

  8. Once your Linode has fully restarted, you need to run the previously mentioned commands to resize your Linode’s Block Storage Volume

    1. Login to your Linode using SSH or Lish.

    2. Unmount the Volume:

      umount /dev/disk/by-id/scsi-0Linode_Volume_BlockStorage1
      
    3. Assuming you have an ext2, ext3, or ext4 partition, run a file system check:

      e2fsck -f /dev/disk/by-id/scsi-0Linode_Volume_BlockStorage1
      
    4. Then resize it to fill the new Volume size:

      resize2fs /dev/disk/by-id/scsi-0Linode_Volume_BlockStorage1
      
    5. Mount your Volume back onto the filesystem:

      mount /dev/disk/by-id/scsi-0Linode_Volume_BlockStorage1 /mnt/BlockStorage1
      

How to Transfer Block Storage Data Between Data Centers

Block Storage Volumes cannot be directly migrated to a different data center. These steps will outline how to transfer a Volume’s data to a different data center via the SCP tool.

Note
Consult our Network Transfer Quota guide for information on charges related to outbound traffic when downloading Linode data outside of Linode’s private network.
  1. Attach and mount your Block Storage Volume to a Linode, if you have not already.

  2. Use the Secure Copy Protocol (SCP) to download your Volume’s data to the receiving computer or Linode.

    Note
    You will need a device that has enough storage capacity to receive the entirety of your Block Storage Volume’s data.
  3. Once your Block Storage Volume’s data has been copied, create a new Block Storage Volume in the desired data center and attach it to a Linode.

  4. Use SCP to upload the data from the receiving computer or Linode to the new Block Storage Volume. The new Block Storage Volume must be attached and mounted to a Linode.

Limitations and Considerations

  • The minimum size for a Volume is 10GB and the maximum size is 10,000 GB (10 TB).

  • To attach a Volume, both the Volume and the Compute Instance must be located in the same data center. Migrating a Volume to a different data center is not directly available at this time. See Transfer Block Storage Data between Data Centers for a work-around.

  • A combined total of 8 storage devices, including a Linode’s local disks and Block Storage Volumes, can be attached to a Linode at the same time.

  • Our Backup Service does not cover Block Storage Volumes. You must manage your own backups if you wish to backup data stored on your Volumes.

  • A Linode must be running in Paravirtualization mode in order to work with our Block Storage service. Block Storage currently does not support Full-virtualization.

Where to Go From Here?

Need ideas for what to do with space? We have several guides which walk you through installing software that would make a great pairing with large storage Volumes:

This page was originally published on


Your Feedback Is Important

Let us know if this guide made it easy to get the answer you needed.


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.