Triton Volumes
Triton Volumes are a network based shared storage mechanism, and provide a way to have persistent filesystem storage that can be attached to one or more instances.
Because Triton Volumes are network based, they may only be used on fabric networks. Any instance may mount any volumes that are on the same fabric network(s). Because of this, it is often recommended to create dedicated networks for volume access.
Listing Available Sizes
Use the triton volume sizes
command to determine which volume sizes are available in the datacenter you are using.
$ triton volume sizes
TYPE SIZE
tritonnfs 10G
tritonnfs 20G
...
tritonnfs 900G
tritonnfs 1000G
Creating a Volume
Volumes can be created using the triton volume create
command.
Tags and affinity rules can also be applied to volumes. See triton help volume create
.
$ triton volume create --name tank --size 10G --network My-Fabric-Network --wait
Creating volume tank (4f73cbcd-60d3-4a6f-9a8d-673d3ed4deb8)
Created volume tank (4f73cbcd-60d3-4a6f-9a8d-673d3ed4deb8)
List existing volumes
To view your volumes use the triton volume list
or triton volumes
command.
$ triton volumes
SHORTID NAME SIZE TYPE STATE AGE
4f73cbcd tank 10G tritonnfs ready 4m
Use the -l
flag to produce a long list, which will include the volume filesystem path.
$ triton volumes -l
ID NAME SIZE TYPE RESOURCE STATE CREATED
4f73cbcd-60d3-4a6f-9a8d-673d3ed4deb8 tank 10G tritonnfs 192.168.128.69:/zones/3024606f-fedb-4b61-9c0f-3fe7085c3eb2/data ready 2024-03-18T20:13:36.900Z
You can also use the triton volume get
command to view the properties of the volume.
$ triton volume get tank
{
"name": "tank",
"owner_uuid": "f61d463c-fd94-4f83-a17f-8b371186124c",
"size": 10240,
"type": "tritonnfs",
"state": "ready",
"networks": [
"b9bfcf53-df1b-4904-bc3e-aef637bd036c"
],
"filesystem_path": "192.168.128.69:/zones/3024606f-fedb-4b61-9c0f-3fe7085c3eb2/data",
"refs": [],
"id": "4f73cbcd-60d3-4a6f-9a8d-673d3ed4deb8",
"tags": {},
"created": "2024-03-18T20:13:36.900Z"
}
Attaching Volumes to instances at create time
When creating native SmartOS (joyent brand) or LX brand zones, volumes can be attached at create time. This registers the instance as a consumer of the volume. Volumes with registerd consumers cannot be destroyed while consumers exist.
For native SmartOS (joyent brand) or LX brand instances, volumes attached at create time will be automatically mounted in the instance.
$ triton create base-64-lts g1.nano --name dozer --network MNX-Triton-Public,My-Fabric-Network --volume tank:/tank -w
Creating instance dozer (ed51baed-a59a-4db5-beb8-da6b1440b30a, base-64-lts@23.4.0)
Created instance dozer (ed51baed-a59a-4db5-beb8-da6b1440b30a) in 1m3s
$ triton ssh dozer
Warning: Permanently added '8.225.232.56' (ED25519) to the list of known hosts.
,---. | ,---. ,---.
`---. ,-.-. ,---. ,---. |--- | | `---. base-64-lts
| | | | ,---| | | | | | 23.4.0
`---' ` ' ' `---' ` `---' `---' `---'
[root@dozer ~]# mount | grep tank
/tank on 192.168.128.69:/zones/3024606f-fedb-4b61-9c0f-3fe7085c3eb2/data remote/read/write/setuid/nodevices/xattr/zone=ed51baed-a59a-4db5-beb8-da6b1440b30a/dev=9540001 on Mon Mar 18 20:24:14 2024
Note that since this is a joyent brand zone, the share is already mounted.
Mounting Volumes in Instances
For HVM (bhyve or KVM) volumes must be mounted manually, with a config management system, with cloud-init, or some other process. For the exact documentation consult the management system you are using. Native SmartOS (joyent brand) or LX brand instances may also mount volumes manually.
The following example should work on most systems, but does not define a persistent mount. LX instances may need to use /native/usr/bin/mount
instead of /usr/bin/mount
.
root@hopper:~# mkdir /tank
root@hopper:~# apt-get install nfs-common
...
root@hopper:~# mount 192.168.128.69:/zones/3024606f-fedb-4b61-9c0f-3fe7085c3eb2/data /tank
root@hopper:~# mount | grep tank
192.168.128.69:/zones/3024606f-fedb-4b61-9c0f-3fe7085c3eb2/data on /tank type nfs4 (rw,relatime,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.128.71,local_lock=none,addr=192.168.128.69)
The following cloud-init example would be used to configure the example Triton Volume used in this document.
#cloud-config
packages:
- nfs-common
package_update: true
package_upgrade: true
package_reboot_if_required: true
mounts:
- [
"192.168.128.69:/zones/3024606f-fedb-4b61-9c0f-3fe7085c3eb2/data",
"/tank",
"nfs",
"defaults,nofail,nodev,relatime,x-systemd.requires=cloud-init.service",
"0", "0"
]
runcmd:
- mount /tank