Configure your volume
To configure your volume, run the following commands on your Droplet.
# SSH into your droplet
$ ssh root@192.168.1.12
To format the volume, copy and paste the text below:
# Format the volume with ext4 Warning: This will erase all data on the volume. Only run this command on a volume with no existing data.
$ sudo mkfs.ext4 -F /dev/disk/by-id/scsi-0DO_Volume_db2vol-nyc1Copy
To mount the volume, copy and paste the text below:
# Create a mount point under /mnt
$ sudo mkdir -p /mnt/db2vol-nyc1
# Mount the volume
$ sudo mount -o discard,defaults /dev/disk/by-id/scsi-0DO_Volume_db2vol-nyc1 /mnt/db2vol-nyc1
# Change fstab so the volume will be mounted after a reboot
$ echo '/dev/disk/by-id/scsi-0DO_Volume_db2vol-nyc1 /mnt/db2vol-nyc1 ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstabCopy
The volume is now accessible at /mnt/db2vol-nyc1, and you are able to write files and store other data. This data will persist if you detach the volume, and will continue to be available when the volume is reattached to another Droplet. If you want you can customize the commands above, please refer to the following articles:
How To Partition and Format DigitalOcean Block Storage Volumes in Linux
How To Partition and Format Storage Devices in Linux
No comments:
Post a Comment