Guide: Volumes and Images: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| (10 intermediate revisions by the same user not shown) | |||
| Line 8: | Line 8: | ||
=== Create and Attach a Volume === | === Create and Attach a Volume === | ||
# Log in to the [https:// | # Log in to the [https://portal.bw-cloud.org/ Dashboard] and select the correct '''region''' (top left). | ||
# Go to '''Volumes → Volumes → Create Volume''' | # Go to '''Volumes → Volumes → Create Volume''' | ||
# Fill in the form: | # Fill in the form: | ||
| Line 24: | Line 24: | ||
# SSH into your VM: <code>ssh -i /path/to/private-key <user>@<IP-address></code> | # SSH into your VM: <code>ssh -i /path/to/private-key <user>@<IP-address></code> | ||
# Check available block devices with <code>lsblk</code> The new volume will appear with ''no mount point'' | # Check available block devices with <code>lsblk</code> The new volume will appear with ''no mount point''. | ||
# Create a file system, e.g. for ext4: <code>sudo mkfs.ext4 /dev/vdb </code> | # Create a file system, e.g. for ext4: <code>sudo mkfs.ext4 /dev/vdb </code> | ||
#*⚠️ ''Deletes all existing data on the volume!'' | #*⚠️ ''Deletes all existing data on the volume!'' | ||
| Line 35: | Line 35: | ||
# Find the UUID of the device: <code>lsblk -f</code> | # Find the UUID of the device: <code>lsblk -f</code> | ||
# Edit <code>/etc/fstab</code> and add a line like this: <pre>UUID=<the-UUID> /mnt/volume ext4 defaults,nofail 0 2</pre> | # Edit <code>/etc/fstab</code> and add a line like this: <pre>UUID=<the-UUID> /mnt/volume ext4 defaults,nofail 0 2</pre> | ||
# Test the <code>fstab</code> entry: <code>sudo mount -a</code> | # Test the <code>fstab</code> entry: <code> sudo systemctl daemon-reload; sudo mount -a </code> | ||
=== Safely Detach a Volume === | === Safely Detach a Volume === | ||
| Line 50: | Line 50: | ||
#* Select '''Volume''' → '''Extend Volume''' | #* Select '''Volume''' → '''Extend Volume''' | ||
#* Choose a (larger) '''New Size''' and click '''Extend Volume''' | #* Choose a (larger) '''New Size''' and click '''Extend Volume''' | ||
# | # Inside the VM: Check the new size with <code>lsblk</code>. If it still shows the old size: Stop the services using it, unmount it, and then detach and re-attach the volume in the Dashboard and mount it again. | ||
# Inside the VM: Expand the filesystem (e.g. for ext4: <code>sudo resize2fs /dev/vdb</code>). Check the result with <code>df -h</code>. | |||
=== Create a Snapshot (Backup) from a Volume === | === Create a Snapshot (Backup) from a Volume === | ||
Latest revision as of 11:23, 28 November 2025
Operations on Volumes
Create and Attach a Volume
- Log in to the Dashboard and select the correct region (top left).
- Go to Volumes → Volumes → Create Volume
- Fill in the form:
- Name: Assign a descriptive name.
- Source: No source, empty volume (default).
- Type: Choose a volume type, if options are available.
- Size: Set the desired size in GiB (e.g.,
20). - Click Create Volume.
- Once created, go to Volumes → Volumes, select the new volume, then:
- Click Manage Attachments.
- Choose the target instance and click Attach Volume.
- Note the device name shown after attachment (e.g.,
/dev/vdbor/dev/sdb).
Format and Mount the Volume inside the VM
- SSH into your VM:
ssh -i /path/to/private-key <user>@<IP-address> - Check available block devices with
lsblkThe new volume will appear with no mount point. - Create a file system, e.g. for ext4:
sudo mkfs.ext4 /dev/vdb- ⚠️ Deletes all existing data on the volume!
- Create a mount point:
sudo mkdir -p /mnt/volume - Mount the volume:
sudo mount /dev/vdb /mnt/volume - (Optional) Set ownership:
sudo chown $USER:$USER /mnt/volume
Mount the Volume Automatically at Boot
- Find the UUID of the device:
lsblk -f - Edit
/etc/fstaband add a line like this:UUID=<the-UUID> /mnt/volume ext4 defaults,nofail 0 2
- Test the
fstabentry:sudo systemctl daemon-reload; sudo mount -a
Safely Detach a Volume
- Close all open files inside the VM and unmount the volume:
sudo umount /mnt/volume - In the Dashboard:
- Go to Volumes → Volumes
- Select Volume → Manage Attachments → Detach Volume.
Resize a Volume
- In the Dashboard:
- Go to Volumes → Volumes
- Select Volume → Extend Volume
- Choose a (larger) New Size and click Extend Volume
- Inside the VM: Check the new size with
lsblk. If it still shows the old size: Stop the services using it, unmount it, and then detach and re-attach the volume in the Dashboard and mount it again. - Inside the VM: Expand the filesystem (e.g. for ext4:
sudo resize2fs /dev/vdb). Check the result withdf -h.
Create a Snapshot (Backup) from a Volume
Note: If the volume is attached, forcing the snapshot may work, but it’s safer to first detach the volume if possible.
- In the Dashboard:
- Go to Volumes → Volumes
- Select Volume → Create Snapshot
- Choose a descriptive Snapshot Name and click Create Volume Snapshot
- You can create a new volume from the snapshot later.
Exporting and Importing (Volume-)Images
Connect to bwCloud-OS using the OpenStack client.
For volumes, first create an image from the volume:
# openstack volume list
# openstack image create \
--volume <UUID> \
my_volume_as_image
Download an image:
# openstack image list
# openstack image save \
--file my_image_file.img \
<UUID>
Upload a local image file to the image catalog of the selected region and create its metadata entry:
# openstack image create \
--property os_distro=linux \
--property ssh_user=<USER> \
--property hw_video_model=cirrus \
--file my_image_file.img \
<NAME>