Skip to main content

Managing Persistent Disks

Creating Persistent Disks

Use the storage disks create command to create a disk with your size. In the example below we will create 100 GiB disk called "data-1."

crusoe storage disks create \
--name data-1 \
--size 100GiB \
--location us-northcentral1-a \
--block-size 4096

name, size, and location are required arguments. The block-size can be either 512B or 4096B (default). When attaching a disk to a VM, the disk must be in the same location as the VM.

Viewing all disks

Use the storage disks list command to list existing disks.


crusoe storage disks list

Update an existing disk

Use the storage disks resize <name> command to resize existing disks using the --size flag. Here's an example:


crusoe storage disks resize <name> --size <size>

Deleting a disk

info

Warning: deleting a disk is a permanant action.

Use the storage disks delete <name> command to delete a disk of your choice. As an example, you can delete a disk by replacing DISK_NAME with the name of the disk you wish to delete:

crusoe storage disks delete DISK_NAME

Attaching Persistent Disks

Once the disk is created above we can attach and the disk to an instance. In both cases the instance must be in the stopped state.

Use the compute vms attach-disks command to attach a disk to an instance. You can attach multiple disks to an instance with this command as well using a comma separated list of disk names.

crusoe compute vms attach-disks my-vm --disk name=data-1,mode=read-write

Use the compute vms detach-disks command to detach a disk from an instance. You can detach multiple disks from an instance with this command as well using a comma separated list of disk names.

crusoe compute vms detach-disks my-vm --disk name=data-1

Formatting and Mounting Persistent Disks

Once the instance is started, login and use the command lsblk to inspect the available disks attached to the instance. These persistent ssd disks will have the vd[b-z] name. In situations where you have multiple disks with the same size, to associate which disk name corresponds to which disk in the consle you can navigate to /dev/disk/by-id you will see the id after virtio-... matches the serial number for that disk in the console. For example:

lrwxrwxrwx 1 root root  9 Jun 14 17:52 virtio-39734E8567D2ECA55C1 -> ../../vdb

39734E8567D2ECA55C1 matches the serial number in the Crusoe Cloud Instance details console.

Create the filesystem on the block device by running:

mkfs.ext4 /dev/vdb

Mount the volume by creating a /scratch directory and mouting /dev/vdb to /scratch

mount -t ext4 /dev/vdb /scratch

Some additional mount options exist within the ext4 filesystem by passing -O ... for example -O noatime,nodiratime,data=writeback will avoid writing access times, as well disabling journaling if your workloads can benefit from these optimizations.