NAME
ocs-sr - Clonezilla: save or restore a disk or partition(s)
SYNOPSIS
ocs-sr [OPTION] {savedisk|saveparts|restoredisk|restoreparts} IMAGE_NAME DEVICE
DESCRIPTION
ocs-sr is the main command of Clonezilla to save or restore a disk or partition(s). It is usually used in Clonezilla live or in a DRBL environment.
COMMANDS
- savedisk
-
Save the entire disk(s) as an image.
- saveparts
-
Save the partition(s) as an image.
- restoredisk
-
Restore the image to the entire disk(s).
- restoreparts
-
Restore the image to the partition(s).
OPTIONS
Options for saving:
- -noabo, --not-only-access-by-owner
-
Make the image of partition accessible by others (mode 644). Default is 600.
- -senc, --skip-enc-ocs-img
-
Skip encrypting the image with passphrase.
- -enc, --enc-ocs-img
-
Encrypt the image with passphrase via ecryptfs.
- -sgoc, --skip-gocrypt-ocs-img
-
Skip encrypting the image with passphrase (gocryptfs).
- -goc, --gocrypt-ocs-img
-
Encrypt the image with passphrase via gocryptfs.
- -sfsck, --skip-fsck-src-part
-
Skip running fsck on the source file system before saving it.
- -fsck, -fsck-src-part, --fsck-src-part
-
Run fsck interactively on the source file system before saving it.
- -fsck-y, -fsck-src-part-y, --fsck-src-part-y
-
Run fsck automatically on the source file system before saving it. Attempt to fix any detected filesystem corruption automatically.
- -gm, --gen-md5sum
-
Generate the MD5 checksum for the image.
- -gs, --gen-sha1sum
-
Generate the SHA1 checksum for the image.
- -gb2, -gb, --gen-b2sum
-
Generate the BLAKE2 checksum for the image.
- -gb3, --gen-b3sum
-
Generate the BLAKE3 checksum for the image.
- -gmf, --gen-chksum-for-files-in-dev
-
Generate the checksum for files in the source device.
- -i, --image-size SIZE
-
Set the size in MB to split the partition image file into multiple volumes files.
- -j2, --clone-hidden-data
-
Use dd to clone the image of the data between MBR (1st sector) and 1st partition.
- -ntfs-ok, --ntfs-ok
-
Assume the NTFS integrity is OK, do NOT check again (for ntfsclone only).
- -rm-win-swap-hib, --rm-win-swap-hib
-
Try to remove the MS windows swap file and hibernation file in the source partition.
- -q, --use-ntfsclone
-
Use ntfsclone to save NTFS partition (Priority: ntfsclone > partimage > dd).
- -q1, --force-to-use-dd
-
Force to use dd to save partition(s) (inefficient, slow, but works for all file systems).
- -q2, --use-partclone
-
Use partclone to save partition(s) (Priority: partclone > partimage > dd).
- -rescue, --rescue
-
Turn on rescue mode, i.e. try to skip bad sectors.
- -sc, -scs, --skip-check-restorable, --skip-check-restorable-s
-
Skip checking if the image is restorable after it is created.
- -z0, --no-compress
-
Don't compress when saving.
- -z1, --gzip-compress
-
Compress using gzip (default).
- -z1p, --smp-gzip-compress
-
Compress using parallel gzip program (pigz).
- -z2, --bz2-compress
-
Compress using bzip2.
- -z2p, --smp-bzip2-compress
-
Compress using parallel bzip2 program (lbzip2).
- -z3, --lzo-compress
-
Compress using lzop.
- -z4, --lzma-compress
-
Compress using lzma.
- -z5, --xz-compress
-
Compress using xz.
- -z5p, --smp-xz-compress
-
Compress using parallel xz.
- -z6, --lzip-compress
-
Compress using lzip.
- -z6p, --smp-lzip-compress
-
Compress using parallel lzip.
- -z7, --lrzip-compress
-
Compress using lrzip.
- -z8, --lz4-compress
-
Compress using lz4.
- -z8p, --lz4mt-compress
-
Compress using multi-threaded lz4.
- -z9, --zstd-compress
-
Compress using zstd.
- -z9p, --zstdmt-compress
-
Compress using parallel zstd (zstdmt).
- -sfs, --skip-fs-save
-
Do not save the file system for device, just save the rest of files.
- -pe, --passwd-ecryptfs PASSWD
-
Set the password to encrypt the image (ecryptfs).
- -pfe, --passwd-file-ecryptfs FILE
-
Set the password to encrypt the image in the FILE (ecryptfs).
- -pg, --passwd-gocryptfs PASSWD
-
Set the password to encrypt the image (gocryptfs).
- -pfg, --passwd-file-gocryptfs FILE
-
Set the password to encrypt the image in the FILE (gocryptfs).
- -plu, --put-log-files-usb
-
Put Clonezilla live related log files to Clonezilla live USB drive.
- -scpt, --skip-check-part-table
-
Skip checking the partition table of the source disk.
- -luks, --enable-luks MODE
-
Open LUKS device or not. MODE can be either yes or no.
- -dblk, --decrypt-bitlocker MODE
-
Decrypt BitLocker device or not. MODE can be either yes or no.
Options for restoring:
- -f, --from-part PARTITION
-
Restore the partition from image or block device to a different partition.
- -g, --grub-install GRUB_PARTITION
-
Install grub in the MBR. GRUB_PARTITION can be "auto" or a device name.
- -r, --resize-partition
-
Resize the partition to fit the target partition size.
- -k, --no-fdisk, --no-create-partition
-
Do NOT create partition table in target harddisk.
- -icrc
-
Skip Partclone CRC checking.
- -irhr
-
Skip removing the Linux udev hardware records on the restored GNU/Linux.
- -irvd
-
Skip removing the NTFS volume dirty flag after restoration.
- -ius
-
Skip updating syslinux-related files on the restored GNU/Linux.
- -iui
-
Skip updating initramfs file(s) on the restored GNU/Linux.
- -icds, --ignore-chk-dsk-size-pt
-
Skip checking destination disk size before creating the partition table.
- -iefi, --ignore-update-efi-nvram
-
Skip updating boot entries in EFI NVRAM after restoring.
- -k0
-
Create partition table based on the partition table from the image (default).
- -k1
-
Create partition table in the target disk proportionally.
- -k2
-
Enter command line prompt to create partition table manually before restoring.
- -scr, --skip-check-restorable-r
-
Skip checking the image if restorable before restoring.
- -t, --no-restore-mbr
-
Do NOT restore the MBR.
- -t1, --restore-raw-mbr
-
Restore the prebuilt bootloader from syslinux (For Windows only).
- -t2, --no-restore-ebr
-
Do NOT restore the EBR.
- -u, --select-img-in-client
-
Input the image name in clients.
- -e, --load-geometry
-
Force to use the saved CHS (cylinders, heads, sectors).
- -e1, --change-geometry NTFS-BOOT-PARTITION
-
Force to change the CHS value of NTFS boot partition after image is restored.
- -e2, --load-geometry-from-edd
-
Force to use the CHS from EDD (Enhanced Disk Device).
- -j, --create-part-by-sfdisk
-
Use sfdisk to create partition table (default).
- -j0, --create-part-by-dd
-
Use dd to dump the partition table from saved image instead of sfdisk.
- -j1, --dump-mbr-in-the-end
-
Use dd to dump the MBR after disk image was restored.
- -j2, --clone-hidden-data
-
Use dd to clone data between MBR and 1st partition (restoredisk mode only).
- -hn0 PREFIX
-
Change the hostname of MS Windows based on PREFIX-IP.
- -hn1 PREFIX
-
Change the hostname of MS Windows based on PREFIX-MAC.
- --max-time-to-wait TIME
-
When not enough clients have connected, start anyways after TIME seconds.
- -cm, --check-md5sum
-
Check the MD5 checksum for the image.
- -cs, --check-sha1sum
-
Check the SHA1 checksum for the image.
- -cb2, -cb, --check-b2sum
-
Check the BLAKE2 checksum for the image.
- -cb3, --check-b3sum
-
Check the BLAKE3 checksum for the image.
- -cmf, --chk-chksum-for-files-in-dev
-
Check the checksum for the files in the device.
- -srel, --save-restore-error-log
-
Save the error log file in the image dir.
- --mcast-port NO
-
Assign the udp port number for multicast restore.
- -ssnf, --skip-set-netboot-first
-
Skip setting 1st boot device as network in uEFI NVRAM.
General options:
- -l, --language INDEX
-
Set the language to be shown by index number (e.g., 0 or en_US.UTF-8).
- -b, -batch, --batch
-
Run program in batch mode (dangerous!).
- -c, --confirm
-
Wait for confirmation before saving or restoring.
- -d, --debug-mode
-
Enter command mode to debug.
- --debug=LEVEL
-
Output the partimage debug log in directory /var/log/ with debug LEVEL.
- -m, --module MODULE
-
Force to load kernel module MODULE.
- --use-netcat
-
Use netcat instead of nuttcp for network clone.
- --net-filter PROGRAM
-
Use PROGRAM (gzip, bzip2, xz, lz4, zstd, cat) as network filter.
- -o0, --run-prerun-dir
-
Run the script in prerun directory before clone is started.
- -o1, -o, --run-postrun-dir
-
Run the script in postrun directory when clone is finished.
- -w, --wait-time TIME
-
Wait for TIME seconds before saving/restoring.
- -nogui, --nogui
-
Do not show GUI (TUI), use text only.
- -a, --no-force-dma-on
-
Do not force to turn on HD DMA.
- -mp, --mount-point MOUNT_POINT
-
Use NFS to mount MOUNT_POINT as directory ocsroot.
- -or, --ocsroot DIR
-
Specify DIR (absolute path) as directory ocsroot.
- -p, --postaction ACTION
-
Action when finished: [choose|poweroff|reboot|command|CMD].
- -ps, --play-sound
-
Play sound when the job is done.
- -ns, --ntfs-progress-in-image-dir
-
Save the ntfsclone progress tmp file in the image dir.
- -s, --source-IP IPADD
-
Assign the IP address of source machine for device to device cloning.
- -bm, --beginner-mode
-
Run in beginner mode.
- -em, --expert-mode
-
Run in expert mode.
- -um, --user-mode [beginner|expert]
-
Specify the user mode.
- -edio, --enable-direct-io
-
Enable the direct IO mode of Partclone for NVMe SSD.
- -smtd, --save-mtdblock
-
Save MTD block device.
- -smmcb, --save-mmcblk
-
Save eMMC boot device.
- -rmtd, --restore-mtdblock
-
Restore MTD block device.
- -rmmcb, --restore-mmcblk
-
Restore eMMC boot device.
- -uoab, --use-ocs-alias-blkdev
-
Use Clonezilla alias block device name (e.g., ocs-*d*).
- -reluks, --reencrypt-luks
-
Reencrypt LUKS encrypted volumes in-place.
- -v, --verbose
-
Prints verbose information.
- -d0, --dialog
-
Use dialog.
- -d1, --Xdialog
-
Use Xdialog.
- -d2, --whiptail
-
Use whiptail.
- -d3, --gdialog
-
Use gdialog.
- -d4, --kdialog
-
Use kdialog.
- -x, --interactive
-
Interactive mode.
- -os, --ocs-server SRV
-
Assign the OCS server as SRV.
RESERVED WORDS
For IMAGE_NAME:
- ask_user
-
Prompt user to input a name.
- autoname
-
Automatically generate image name based on MAC address and time.
- autohostname
-
Automatically generate image name based on hostname.
- autoproductname
-
Automatically generate image name based on hardware product model.
For DEVICE:
- ask_user
-
Prompt user to select the source device.
- all
-
Select all unmounted local disks or partitions.
EXAMPLES
To save all data in local 1st harddrive 'sda' as image 'IMAGE1', use ntfsclone, and lzop compression:
-
ocs-sr --use-ntfsclone -z3 savedisk IMAGE1 sda
To save the data in 1st and 2nd partition in local first harddrive 'sda' as image 'IMAGE2', use ntfsclone:
-
ocs-sr --use-ntfsclone -z3 saveparts IMAGE2 "sda1 sda2"
To restore image IMAGE1 to local sda, and grub-install will be run after cloning:
-
ocs-sr -g auto restoredisk IMAGE1 sda
To restore the image for the 1st and 2nd partition from IMAGE2 to local sda1 and sda2, and grub-install will be run after restoring:
-
ocs-sr -g auto restoreparts IMAGE2 "sda1 sda2"
To save disk(s)/partition(s) as an image or restore an image to disk(s)/partition(s) interactively, use:
-
ocs-sr -x
FILES
- /etc/drbl/drbl-ocs.conf
-
The configuration file for Clonezilla.
SEE ALSO
drbl-ocs(8), ocs-onthefly(8)
AUTHORS
Steven Shiau <steven _at_ clonezilla org>