Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/takuya/ruby-lvm-snapshot-wrapper
Wrapper for lvm, to use lvm snapshot.
https://github.com/takuya/ruby-lvm-snapshot-wrapper
Last synced: 21 days ago
JSON representation
Wrapper for lvm, to use lvm snapshot.
- Host: GitHub
- URL: https://github.com/takuya/ruby-lvm-snapshot-wrapper
- Owner: takuya
- License: gpl-3.0
- Created: 2023-01-06T03:54:01.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-01-31T18:47:54.000Z (almost 2 years ago)
- Last Synced: 2024-10-13T18:53:11.451Z (about 1 month ago)
- Language: Ruby
- Size: 1.01 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Takuya::Lvm::Snapshot
Wrapper for lvm, to use lvm snapshot.
## exampleThis package make easy to Take Snapshot and Backup.
```ruby
require "takuya/lvm_snapshot"
LvmSnapShot = Takuya::LvmSnapShotLvmSnapShot.new('vg0').enter_snapshot('lv0'){
## backup from snapshot
FileUtils.cp_r('/mnt/var/lib/mysql', '/nfs/backup/mysql')
}
```Using proc call, We can focus on backup steps.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'takuya-lvm-snapshot'
```
And then execute:```sh
bundle config set --local path '.bundle'
bundle install
```
Or install it yourself as:
```sh
gem install takuya-lvm-snapshot
```### Installation from github
Add Following line into Gemfile.
```
gem 'takuya-lvm-snapshot', git: 'https://github.com/takuya/ruby-lvm-snapshot-wrapper.git'
```## Usage
create / list / delete lvm snapshot
```ruby
require "takuya/lvm_snapshot"
LvmSnapShot = Takuya::LvmSnapShotlvsnap = LvmSnapShot.new('vg_name')
lvsnap.create('snap_01')
lvsnap.exists('snap_01')
lvsnap.mount('snap_01','/mnt')
lvsnap.unmount('snap_01','/mnt')
lvsnap.remove('snap_01')
```This package make easy to Take Snapshot and backup.
```ruby
require "takuya/lvm_snapshot"
LvmSnapShot = Takuya::LvmSnapShotLvmSnapShot.new('vg0').enter_snapshot{|mnt|
## make working snapshot.
## backup from snapshot.
## no stopping sevices.
FileUtils.cp_r('/mnt/var/lib/mysql', '/nfs/backup/mysql')
}
```#### Example.
Make use of LVM Snap Shot allows us to Backup without stopping services.```ruby
require "takuya/lvm_snapshot"
LvmSnapShot = Takuya::LvmSnapShotLvmSnapShot.new('vg0','lv0','20G','/mnt').enter_snapshot{|mnt|
## backup from snapshot
src="#{mnt}/var/lib/libvirt/images/my-vm.qcow2"
cmd="rsync -a '#{src}' myserver:~/my-backup "
`#{cmd}`
}
```## Testing
```sh
bundle exec rspec spec
```
## Releasing
```sh
bundle exec rake release
```
## DevelopmentAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake ` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/takuya/ruby-lvm-snapshot-wrapper/.