-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* start volume rework * add landing page and nav and minor edits * test typo * fix typo * fix links * change tip to note * updates and edits * update nav and move index * fixes * update nav and fix some links * capitalization and naming * final changes and revert to old nav
- Loading branch information
Showing
7 changed files
with
338 additions
and
357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
--- | ||
title: Manage volume storage | ||
layout: docs | ||
nav: firecracker | ||
order: 40 | ||
--- | ||
|
||
Manage Fly Volumes using the [`fly volumes`](/docs/flyctl/volumes/) command. | ||
|
||
<div class="note icon">**Note**: `fly volumes` is aliased to `fly volume` and `fly vol`.</div> | ||
|
||
## Create a volume | ||
|
||
Run: | ||
|
||
```cmd | ||
fly vol create <my_volume_name> | ||
``` | ||
|
||
Use the `-r` option to set a [region](/docs/reference/regions/), or select a region when prompted. | ||
|
||
For options, refer to the [`fly volumes create` docs](/docs/flyctl/volumes-create/) or run `fly vol create -h`. | ||
|
||
To add a volume to your app, refer to [Add volume storage](/docs/apps/volume-storage/). | ||
|
||
## Access a volume | ||
|
||
You can access and write to a volume on a Machine just like a regular directory. | ||
|
||
For Machines managed with Fly Launch, the `destination` under `[mounts]` in `fly.toml` is the path for the mounted volumes. | ||
|
||
For Machines managed individually, specify the mount path in the `fly machine clone` command when you [clone a Machine and add a volume](/docs/apps/volume-storage/#add-a-volume-to-a-machine-clone). | ||
|
||
## Extend a volume | ||
|
||
You can extend (increase) a volume's size, but you can't make a volume smaller. | ||
|
||
1. Run `fly volumes list` and copy the volume ID. | ||
|
||
1. Extend the volume size: | ||
|
||
```cmd | ||
`fly vol extend <volume id> -s <new size in GB>` | ||
``` | ||
|
||
1. (Optional) Check the new volume size in the Machine's file system: | ||
|
||
```cmd | ||
fly ssh console -s -C df | ||
``` | ||
|
||
Example output: | ||
```out | ||
? Select VM: [Use arrows to move, type to filter] | ||
> yyz: 4d891de2f66587 fdaa:0:3b99:a7b:ef:8cc4:dc49:2 withered-shadow-4027 | ||
Connecting to fdaa:0:3b99:a7b:ef:8cc4:dc49:2... complete | ||
Filesystem 1K-blocks Used Available Use% Mounted on | ||
devtmpfs 103068 0 103068 0% /dev | ||
/dev/vda 8191416 172752 7582852 3% / | ||
shm 113224 0 113224 0% /dev/shm | ||
tmpfs 113224 0 113224 0% /sys/fs/cgroup | ||
/dev/vdb 2043856 3072 1930400 1% /storage | ||
``` | ||
|
||
In the preceding example, the volume is mounted under `/storage` and has been resized to 2GB. The `df` command shows disk space in 1K blocks by default. Use the `-h` flag to return a more human-readable format. | ||
|
||
For options, refer to the [`fly volumes extend` docs](/docs/flyctl/volumes-extend/) or run `fly vol extend -h`. | ||
|
||
## Restore a volume from a snapshot | ||
|
||
We take daily snapshots and keep them for five days. | ||
|
||
1. Run `fly volumes list` and copy the volume ID. | ||
|
||
1. List the volume's snapshots: | ||
|
||
```cmd | ||
fly vol snapshots <volume id> | ||
``` | ||
|
||
Example output: | ||
```out | ||
Snapshots | ||
ID SIZE CREATED AT | ||
vs_MgLAggLZkYx89fLy 17638389 1 hour ago | ||
vs_1KRgwpDqZ2ll5tx 17649006 1 day ago | ||
vs_nymJyYMwXpjxqTzJ 17677766 2 days ago | ||
vs_R3OPAz5jBqzogF16 17689473 3 days ago | ||
vs_pZlGZvq3gkAlAcaZ 17655830 4 days ago | ||
vs_A9k6age3bQov6twj 17631880 5 days ago | ||
``` | ||
|
||
1. Restore from the volume snapshot into a new volume of equal or greater size: | ||
|
||
```cmd | ||
fly volumes create <volume name> --snapshot-id <snapshot id> -s <volume size in GB> | ||
``` | ||
|
||
Example output: | ||
```out | ||
? Select region: Sydney, Australia (syd) | ||
ID: vol_mjn924o9l3q403lq | ||
Name: pg_data | ||
App: my-app-name | ||
Region: syd | ||
Zone: 180d | ||
Size GB: 3 | ||
Encrypted: true | ||
Created at: 02 Aug 22 21:27 UTC | ||
``` | ||
|
||
For options, refer to the [`fly volumes snapshots` docs](/docs/flyctl/volumes-snapshots/) or run `fly vol snapshots -h`. | ||
|
||
## Clone a Machine with a volume | ||
|
||
Clone a Machine with a volume to create a new Machine in the same region with an empty volume. Use the `-r` option to clone the Machine into a different [region](/docs/reference/regions/). | ||
|
||
1. Run `fly status` and copy the Machine ID of the Machine to clone. | ||
|
||
1. Clone the Machine: | ||
|
||
```cmd | ||
fly m clone <machine id> | ||
``` | ||
|
||
1. List volumes to check the result: | ||
|
||
```cmd | ||
fly volumes list | ||
``` | ||
|
||
Example output showing two volumes with attached Machines: | ||
```out | ||
ID STATE NAME SIZE REGION ZONE ENCRYPTED ATTACHED VM CREATED AT | ||
vol_ez1nvxkwl3jrmxl7 created data 1GB lhr 4de2 true 91851edb6ee983 39 seconds ago | ||
vol_zmjnv8m81p5rywgx created data 1GB lhr b6a7 true 5683606c41098e 7 minutes ago | ||
``` | ||
|
||
<div class="warning icon"> | ||
<b>Warning:</b> `fly machine clone` doesn't write data into the new volume. | ||
</div> | ||
|
||
For options, refer to the [`fly machine clone` docs](/docs/flyctl/machine-clone/) or run `fly m clone -h`. | ||
|
||
## Destroy a volume | ||
|
||
When you destroy a volume, you delete all its data. | ||
|
||
Run: | ||
|
||
```cmd | ||
fly vol destroy <volume id> | ||
``` | ||
|
||
For options, refer to the [`fly vol destroy` docs](/docs/flyctl/volumes-destroy/) or run `fly vol destroy -h`. | ||
|
||
## Related topics | ||
|
||
- [Fly Volumes overview](/docs/reference/volumes/) | ||
- [Add volume storage](/docs/apps/volume-storage/) | ||
- [Scale an app with volumes](/docs/apps/scale-count/#scale-an-app-with-volumes) |
Oops, something went wrong.