vagrant



Vagrant1.8以降ではスナップショット機能が使えます。
コマンドを打つだけでスナップショットの作成、復元が行えてとても便利です。

保存

$ vagrant snapshot save backup

復元

$ vagrant snapshot restore backup


詳しくはこちらの記事にまとまっているので参考にしてください。

Vagrant1.8で追加されたSnapshot機能のまとめ - Qiita


Vagrantfileで複数のVMを立ち上げている場合

普通に入力すると同名のスナップショットがそれぞれ作られます。

$ vagrant snapshot save backup
==> first: Snapshotting the machine as 'backup'...
==> first: Snapshot saved! You can restore the snapshot at any time by
==> first: using `vagrant snapshot restore`. You can delete it using
==> first: `vagrant snapshot delete`.
==> second: Snapshotting the machine as 'backup'...
==> second: Snapshot saved! You can restore the snapshot at any time by
==> second: using `vagrant snapshot restore`. You can delete it using
==> second: `vagrant snapshot delete`.

一覧表示で確認

$ vagrant snapshot list
backup
backup


一つのVMのスナップショットだけ対象にしたいときには次の書式で可能です。

$ vagrant snapshot save [VM名] [スナップショット名]

保存

$ vagrant snapshot save first backup

復元

$ vagrant snapshot restore first backup

一覧表示で確認

$ vagrant snapshot list
==> first: No snapshots have been taken yet!
    first: You can take a snapshot using `vagrant snapshot save`. Note that
    first: not all providers support this yet. Once a snapshot is taken, you
    first: can list them using this command, and use commands such as
    first: `vagrant snapshot restore` to go back to a certain snapshot.
backup
  • About

    I'm a web designer/programmer in Kyoto, Japan. Also work as a blogger, DJ.

    NOBODY:PLACE is my personal blog since 1998. Everything I'm interested in is here.

    See Also
    Other Works
    Feed
  • Recent Hatena Bookmark
  • Monthly Archives
    Categories