Attach and detach a volume
Each volume can to be attached to a single Compute Instance within the same data center, which enables that Compute Instance to read and write data to that volume. Volumes can also be detached, and its data cannot be accessed until it is again attached to any Compute Instance within the same data center.
Attach a volume
Learn how to attach an existing Block Storage volume to a Compute Instance using these steps:
-
Log in to Cloud Manager and click on the Volumes link in the sidebar.
-
Locate the desired volume within the list, click the more options ellipsis dropdown menu, and select Attach.
-
Complete the Attach Volume form that appears.
- Linode: Use the dropdown menu to select the Compute Instance you'd like to use. The volume will be attached to this Compute Instance.
- Config: If the Compute Instance has multiple Configuration Profiles, select which one the Block Storage volume should be assigned to. This field will not be displayed if the Compute Instance has only a single profile.
The Compute Instance must be located within the same data center as the Block Storage volume.
If your Compute Instance was deployed before August 24th, 2021 and hasn't been rebooted since your data center was upgraded to NVMe Block Storage, you may need to reboot the Compute Instance for it to properly work with a Block Storage volume.
-
Click the Save button to attach the volume.
-
To start using the volume on the Compute Instance, 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 Compute Instance to automatically mount the volume at boot. To learn more about these configuration steps, see Configure and mount a volume.
Do not create a new file system if you wish to retain any existing data on the volume. Creating a new file system will overwrite any existing data and result in data loss.
Detach a volume
Follow these steps to safely detach a Block Storage volume from a Compute Instance. A volume should be detached before it is reattached to a different Compute Instance.
-
Log in to Cloud Manager and click on the Linodes link in the sidebar.
-
Select the Compute Instance that the volume is currently attached to.
-
It's recommended to power off the Compute Instance. To do this, click Power Off on the top right of the Compute Instance details page.
-
If a volume is currently mounted, detaching it while the Compute Instance is powered on could cause data loss or an unexpected reboot. You can unmount the volume for safe live-detaching by logging in to the Compute Instance over SSH or Lish and running the
umount
command, such as in the example below.umount /dev/disk/by-id/scsi-0Linode_Volume_example-volume-1
Replace the device path with the one for your own volume (which can be viewed from the Show Config link). To avoid additional issues with your Compute Instance, remove the detached volume's line from your
/etc/fstab/
configuration.FILE_SYSTEM_PATH /mnt/example-volume-1 ext4 defaults 0 2
-
Navigate to the Storage tab.
-
Locate the volume you wish to detach within the Volumes list, click the more options ellipsis dropdown menu, and select Detach.
-
A confirmation screen appears and explains that the volume will be detached from the Compute Instance. Click Detach to confirm.
Detached volumes still exist on your account and, as such, you are still billed for the volume as normal. It can be viewed and deleted within the Volumes listing page in Cloud Manager. See View, add, and delete volumes.
Updated about 2 months ago