EZIO is a tool for rapid server disk image cloning/deployment within local area network. We utilize BitTorrent protocol to speed up the data distribution. Also, we use partclone
to dump used filesystem blocks, and EZIO receiver can directly write received blocks to raw disk, which greatly improves performance.
- Ubuntu>=16.10
sudo apt-get install libtorrent-rasterbar-dev -y
- Ubuntu==16.04
# compile libtorrent>=1.1.1
- libtorrent-rasterbar 1.1.1
- this is a special distribution, make sure you install the right version
- boost 1.58 or later
- partclone
- openssh-server
- libboost1.58-all-dev
- libssl-dev
- uuid-dev
- ext2fs-dev
- automake
- if you installed ver 1.15, soft link it to 1.14 may work
- ... and there are some other libraries, check 'INSTALL' document under partclone repository.
Partclone provides utilities to save and restore used filesystem blocks (and skips the unused blocks) from/to a partition.
@mangokingTW made a fork of partclone that outputs sections of continuous blocks into files, these files are used later to create a torrent file.
sudo apt-get install libssl-dev uuid-dev -y
git clone https://github.com/tjjh89017/partclone
cd partclone
...... then choose the filesystem support you want.
For example, extfs suppoort:
./configure --enable-extfs
...... and you should see the result like this picture:
And we can start to build.
make
# if build success, src folder should appear.
cd src && ls
# you would see partclone.Xfs, where X is the fs you choose.
git clone https://github.com/tjjh89017/ezio
cd ezio && make
Here we demonstrate how to clone a disk to machines across the network.
./partclone.Xfs -c -T -s (source partition) -o (output directory name)
- Notice that in current version, the generated files will directly appear in current directory. You may prefer to make an extra folder and use partclone under it.
- also, root permission may be required.
The generated result should look like this:
Each file stores a section of used continuous filesystem blocks. The file name denotes its offset on the partition.
./partclone.extfs -c -T -s /dev/sda1 -o target/ | ezio/utils/partclone_create_torrent.py
Then you will see a.torrent
which contains all files in target/
-T output btfiles and output info for create torrent
-t output torrent info only (for parition-to-partition cloning)
Using qbittorrent
or similar softwares.
Todo: bt client
TODO ezio.conf
TORRENT=/path/to/torrent/in/tftp/server/a.torrent
TARGET=/dev/sda1 # point to the target partition
You can use opentracker to announce.
Normal BT client can be the seeder.
TODO: PXE
In main.cpp#28
implements a libtorrent
custom storage, to allow the receiver to write received blocks directly to raw disk.
We store the "offset" in hex into torrent, the "length" into file attribute. so BT will know where the block is, and it can use the offset to seek in the disk
{
'announce': 'http://tracker.site1.com/announce',
'info':
{
'name': 'root',
'piece length': 262144,
'files':
[
{'path': ['0000000000000000'], 'length': 4096}, // store offset and length of blocks
{'path': ['0000000000020000'], 'length': 8192},
...
],
'pieces': 'some piece hash here'
}
}