DRBL

Diskless Remote Boot in Linux

DRBL management
Clone disk or partition on-the-fly

2016/Apr/05


Clone disk or partition on-the-fly

The "ocs-onthefly" is used to do disk to disk or partition to partition copy on-the-fly. This command is different from drbl-ocs (or clonezilla). Clonezilla is used to do massively clone, so it will save the template machine as an image in clonezilla server. On the other hand, ocs-onthefly is used to 1 to 1 copy, so no image will be saved in the server. Just clone disk or partition directly.
There are 2 ways to run ocs-onthefly:
(1) Clone locally: Boot the machine as DRBL client, then clone one disk to another disk. This is specially for when you just want to clone disk, and you only have one machine.
(2) Clone via network: Boot the source and target machine as DRBL clients, then clone disk from one machine to another machine. This is specially for you have 2 machines, and you want to clone them without dismantling machine.
Usage:
ocs-onthefly [OPTION]
Option:
-e, --resize-partition resize the target disk in target machine (To solve the small partition image restored to larger partition problem.)
-f, --source DEV specify the source device as DEV (hda, hda1...)
-g, --grub-install GRUB_PARTITION install grub in hda with root grub directory in GRUB_PARTITION when restoration finishs, GRUB_PARTITION can be one of "/dev/hda1", "/dev/hda2"... or "auto" ("auto" will clonezilla detects the grub root partition automatically)
-i, --filter PROGRAM use the PROGRAM (gzip/lzop/bzip2/cat) before sending partition data to netcat (only in network clone mode). The default action is gzip. Use "cat" if you do not want to compress (Good for fast internode network).
-n, --no-sfdisk skip partition table creation
-m, --no-mbr-clone do NOT clone MBR
-o, --load-geometry force to use the saved CHS (cylinders, heads, sectors) when using sfdisk in restoring.
-p, --port PORT specify the netcat port (Only in network clone mode)
-r, --server specify the running machine is in network clone server.
-s, --source-IP IP specify the source IP address (used in target client machine).
-t, --target DEV specify the target device as DEV (hda, hda1...)
-v, --verbose prints verbose information
ocs-onthefly [OPTION]


Ex:
1. Clone locally: To clone the 1st harddisk (hda) to 2nd harddisk (hdb), you can boot this machine as DRBL client, then run:
ocs-onthefly -f hda -t hdb

2. Clone via network: To clone the 1st harddisk (hda) in machine A to the 1st harddisk (hda) in machine B. Then without dismantling machines, you can do it by:
Boot machine A as DRBL client, and it's IP addiress is, say, 192.168.100.1, then run:
ocs-onthefly -r -f hda

Then it will prompt you the command to run in machine B, such as:
ocs-thefly --source-IP 192.168.100.1 -t [TARGET_DEV] (TARGET_DEV is like hda, hdb, hda1, hdb1...)

The "TARGET_DEV" is the target harddisk in machine B, in this case, it hda.
Then, boot machine B as DRBL client, and run:
ocs-onthefly --source-IP 192.168.100.1 -t hda