---
title: "CLI — Storage"
description: "Metalhost CLI commands for block disks and NFS file shares."
url: "https://metalhost.net/docs/developers/guides/cli-storage"
---

# CLI — Storage

`metalhost disk` and `metalhost file-share` (also under `metalhost storage disk …`) manage persistent data volumes.

## Block disks

| Command | What it does |
| --- | --- |
| `disk list` | List disks in the project. |
| `disk get NAME` | Get a disk. |
| `disk create --size-gib N --region DC` | Create a disk (`--from-image-url` to hydrate). |
| `disk resize NAME --size-gib N` | Grow a disk (no shrink). |
| `disk attach NAME --vm VM` | Hot-attach to a running VM. |
| `disk detach NAME` | Detach from VM. |
| `disk delete NAME` | Delete (must be detached). |

```
metalhost disk create --size-gib 100 --region datacenters/us-dal-1
metalhost disk attach projects/my-app/disks/data-1 --vm web-1
metalhost disk resize projects/my-app/disks/data-1 --size-gib 200
```

## Single-disk backups (v1.1.0)

```
metalhost disk backup create projects/my-app/disks/data-1 --display-name before-upgrade --idempotency-key capture-1
metalhost disk backup list --project projects/my-app --all
metalhost disk backup get disk-snapshots/ID
metalhost disk create --project projects/my-app --from-backup disk-snapshots/ID --id restored-data --size-gib 100 --region datacenters/us-dal-1 --network projects/my-app/networks/default
```

Wait for READY before restoring. Use the source backup's project, network, datacenter and storage tier, and at least its reported size. The restored disk is a new, separately billed resource; poll `disk get` until AVAILABLE. Reuse the same `--id` when retrying a restore. `disk backup delete NAME` prompts before permanent deletion.

## Automatic schedules (v1.1.0)

```
metalhost storage backup-schedule create --project projects/my-app --target virtual-machines/ID --cadence daily --hour-utc 3 --keep 7 --idempotency-key schedule-1
metalhost storage backup-schedule list --project projects/my-app --all
metalhost storage backup-schedule update snapshot-schedules/ID --enabled=false
metalhost storage backup-schedule update snapshot-schedules/ID --keep 3
metalhost storage backup-schedule delete snapshot-schedules/ID
```

CLI schedules use fixed UTC times: `--cadence hourly|daily|weekly`, `--minute-utc 0..59`, `--hour-utc 0..23`, and `--weekday-utc 0..6` (Sunday=0). Omit the target to cover every VM and each unattached disk in the selected project. Updates affect only supplied fields. Deleting a schedule keeps its backups; keep-N retention never prunes manual copies. Leave quota headroom for the next successful copy.

## File shares

| Command | What it does |
| --- | --- |
| `file-share list` | List NFS shares. |
| `file-share create --size-gib N --region DC` | Create an NFSv4 share. |
| `file-share delete NAME` | Delete a share. |

The create response includes a `mount_command` — paste into cloud-init or run on the VM.

## What's next

- [Dashboard → Storage](https://metalhost.net/docs/dashboard/guides/storage.md)
- [Go SDK — Storage](https://metalhost.net/docs/developers/guides/sdk-storage.md)
