NavigationContentFooter
Jump toSuggest an edit

Block Storage - Quickstart

Reviewed on 23 November 2023Published on 23 November 2023

Scaleway Block Storage provides network-attached storage that can be plugged in and out of cloud products such as Instances like a virtual hard-drive. Block Storage devices are independent of the local storage of Instances, and the fact that they are accessed over a network connection makes it easy to move them between Instances in the same Availability Zone. From the user’s point of view, once mounted, the block device behaves like a regular disk.

Security & Identity (IAM)

To perform certain actions described below, you must either be the Owner of the Organization in which the actions will be performed or an IAM user with the necessary permissions.

Requirements
  • You have an account and are logged into the Scaleway console
  • You have created an Instance

How to create a Block Storage volume

  1. Click Block Storage in the Storage section of the Scaleway console side menu. The Block Storage page displays.
  2. Click +Create volume.
  3. Follow the steps in the creation wizard:
    • Choose an Availability Zone.

    • Configure the volume:

      • Enter a name for your volume or leave the automatically-generated name.
      • Select an IOPS.
      Important

      You cannot edit the IOPS after you create your volume.

      • Define a volume size.
      Important

      The volume size must be of at least 5GB.

    • Select an Instance from the drop-down to attach your volume. This step is optional.

    • Check the estimated cost.

  4. Click Create volume. The volumes overview page displays.
    Important

    The volume must be in the same Availability Zone as the Instance you want to connect it to.

How to attach a Block Storage volume to an Instance

  1. Click Block Storage in the Storage section of the Scaleway console side menu. Your volumes display.
  2. Click «See more Icon» > Attach to Instance next to the volume of your choice. A pop-up displays.
  3. Select the Instance to which you want to attach your volume from the drop-down.
  4. Click Attach volume to Instance.

How to mount and use a Block Storage volume

In order to mount and use your Block Storage volume, you need to connect to the Instance it is attached to via SSH. Then, check that the volume is available, format it and mount it, following the instructions below.

How to verify device availability

  1. Open a terminal and connect to your Instance with ssh. Make sure you replace <your_instance_ip> with your Instance’s public IP.

    ssh root@<your_instance_ip>
  2. Use the lsblk command to make sure your block volume is available.

    You should see an output like the following. You can see your block volume named sda with the chosen storage size.

    root@scw-festive-agnesi:~# lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 0 23.3G 0 disk
    vda 252:0 0 18.6G 0 disk
    ├─vda1 252:1 0 18.5G 0 part /
    └─vda15 252:15 0 100M 0 part /boot/efi
    Note

    The Scaleway ecosystem uses GB to define storage sizes and not GiB as default on Linux.

How to format the Block Storage volume

  1. Create a file system with the following command. This command uses the ext4 filesystem, though you can choose another if you prefer.
    mkfs.ext4 /dev/sda
  2. Run the lsblk -f command to make sure your file system was correctly created.

You should see an output like the following. Check that the FSTYPE field matches ext4 for your Block volume.

root@scw-festive-agnesi:~# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda ext4 925c2c17-ca8c-493a-a9cd-b475d87fd276
vda
├─vda1 ext4 root 8509fe04-d91c-410a-9087-c5d34537d3ae /
└─vda15 vfat B3E7-7040 /boot/efi

Check that the FSTYPE field matches ext4 for your volume.

How to mount the Block Storage volume

Once you have created your file system, you need to mount it.

  1. Create the mount point. In this tutorial, we choose /mnt/block-volume.

    mkdir /mnt/block-volume
  2. Mount the volume. We recommend that you use the defaults option, as in the command below.

    mount -o defaults /dev/sda /mnt/block-volume
    **defaults**
    Use the default options: **rw**, **suid**, **dev**,
    **exec**, **auto**, **nouser**, and **async**.

    If you want to see all available options, you can run man mount on your Instance.

    root@scw-festive-agnesi:~# mount -o defaults /dev/sda /mnt/block-volume
  3. Run the lsblk command to make sure your file system is properly mounted.

    You should see an output like the following. Check the MOUNTPOINT field.

    root@scw-festive-agnesi:~# lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 0 23.3G 0 disk /mnt/block-volume
    vda 252:0 0 18.6G 0 disk
    ├─vda1 252:1 0 18.5G 0 part /
    └─vda15 252:15 0 100M 0 part /boot/efi

How to use fstab for Persistent Mounting

With the current configuration, the block device will not be mounted automatically upon reboot. Use the fstab file to make sure the reboot does not impact your file system.

Add this line to the /etc/fstab file of your Instance:

echo "UUID=$(blkid --output value /dev/sda | head -n1) /mnt/block-volume ext4 defaults 0 0" >> /etc/fstab

You can now use your Block Storage volume like a regular disk of your Instance, and store data on it as you wish.

Cloud Products & Resources
  • Scaleway Console
  • Compute
  • Storage
  • Network
  • IoT
  • AI
Dedicated Products & Resources
  • Dedibox Console
  • Dedibox Servers
  • Network
  • Web Hosting
Scaleway
  • Scaleway.com
  • Blog
  • Careers
  • Scaleway Learning
Follow us
FacebookTwitterSlackInstagramLinkedin
ContractsLegal NoticePrivacy PolicyCookie PolicyDocumentation license
© 1999-2024 – Scaleway SAS