# Drives



Drives is a CLI for creating and synchronizing Hyperdrives. This page documents the public commands installed by [`drives`](https://github.com/holepunchto/drives).

## System support [#system-support]

Desktop only: macOS, Linux, and Windows are supported. Drives is not available on Android or iOS.

## Install [#install]

```sh
npm i -g drives
```

## `drives touch` [#drives-touch]

[Command source on GitHub](https://github.com/holepunchto/drives/blob/v3.1.0/bin.js)

Create a writable [Hyperdrive](/p2p/reference/building-blocks/hyperdrive) and print its public key.

```sh
drives touch [options]
```

Flags:

* `--storage [path]`: storage directory for the local corestore.
  Default: the upstream docs describe `~/.drives`; current CLI code stores the corestore beneath that directory
* `--help`: show help.

Example:

```sh
drives touch
```

## `drives mirror <src> <dst>` [#drives-mirror-src-dst]

[Command source on GitHub](https://github.com/holepunchto/drives/blob/v3.1.0/bin.js)

Mirror a local directory into a [Hyperdrive](/p2p/reference/building-blocks/hyperdrive), mirror a Hyperdrive into a local directory, or mirror between two local targets.

```sh
drives mirror <src> <dst> [options]
```

Arguments:

* `<src>`: source drive key or local folder path.
* `<dst>`: destination drive key or local folder path.

Flags:

* `--live`: keep mirroring as changes arrive.
  Default: off
* `--version [v]`: mirror a specific drive version instead of the latest version.
  Default: latest version
* `--storage [path]`: storage directory for the local corestore.
  Default: the upstream docs describe `~/.drives`; current CLI code stores the corestore beneath that directory
* `--help`: show help.

Notes:

* `.DS_Store` is ignored automatically.
* If the source root contains `/.drivesignore`, the ignore patterns are applied during the mirror. The ignore file is read once at startup, so changing it during a `--live` mirror has no effect until you restart the command.
* `drives mirror` makes the destination match the source in either direction, so entries on the destination that do not exist on the source can be deleted—whether the destination is a Hyperdrive or a local folder.

Example:

```sh
drives mirror ./site <drive-key>
```

## `drives seed [key]` [#drives-seed-key]

[Command source on GitHub](https://github.com/holepunchto/drives/blob/v3.1.0/bin.js)

Announce a [Hyperdrive](/p2p/reference/building-blocks/hyperdrive) so other peers can download it.

```sh
drives seed [key] [options]
```

Arguments:

* `[key]`: drive public key to seed.
  Default: if omitted, the CLI uses the drive already present in the selected storage namespace

Flags:

* `--storage [path]`: storage directory for the local corestore.
  Default: the upstream docs describe `~/.drives`; current CLI code stores the corestore beneath that directory
* `--help`: show help.

Notes:

* `drives seed` is a long-running command.
* The status output includes the drive key, replication status, and connected peers.

Example:

```sh
drives seed <drive-key>
```

## Common workflows [#common-workflows]

### Create a drive, mirror a directory into it, and seed it [#create-a-drive-mirror-a-directory-into-it-and-seed-it]

Create a new drive and keep the printed key:

```sh
drives touch
```

Mirror a local directory into that drive:

```sh
drives mirror ./site <drive-key>
```

Seed it so another peer can download it:

```sh
drives seed <drive-key>
```

### Mirror a drive back into a local directory [#mirror-a-drive-back-into-a-local-directory]

On another machine, pull the drive into a folder:

```sh
drives mirror <drive-key> ./site-copy
```

### Keep a destination up to date with live mirroring [#keep-a-destination-up-to-date-with-live-mirroring]

Push local changes continuously:

```sh
drives mirror --live ./site <drive-key>
```

Or follow a live drive into a local folder:

```sh
drives mirror --live <drive-key> ./site-copy
```

### Pull a fixed snapshot by version [#pull-a-fixed-snapshot-by-version]

Mirror a specific version instead of the latest head:

```sh
drives mirror --version 3 <drive-key> ./snapshot
```

### Use `.drivesignore` to skip generated files [#use-drivesignore-to-skip-generated-files]

Create `./site/.drivesignore` in the source directory:

```txt
node_modules/
dist/
*.log
```

Then mirror as usual:

```sh
drives mirror ./site <drive-key>
```

## See also [#see-also]

* [Hyperdrive](/p2p/reference/building-blocks/hyperdrive)
* [Localdrive](/p2p/reference/helpers/localdrive)
* [Mirrordrive](/p2p/reference/helpers/mirrordrive)—the sync engine powering `drives mirror`.
* [Hypershell—`hypershell-copy`](/p2p/reference/tools/hypershell#hypershell-copy)
* [Hyperbeam—one-to-one pipe for ad-hoc transfers](/p2p/reference/tools/hyperbeam#hyperbeam)
* [Pear CLI](/pear/reference/pear/cli)
