Clonezilla

The Free and Open Source Software for Disk Imaging and Cloning
Step-by-step docs

Reserved image and device names for command ocs-sr

A normal ocs-sr command is like:
  • Saving mode: ocs-sr -q2 -c -j2 -z1p -i 2000 -p true savedisk IMAGENAME DEVICENAME
  • Restoring mode: ocs-sr -g auto -e1 auto -e2 -c -r -j2 -p true restoredisk IMAGENAME DEVICENAME
In the above examples, "IMAGENAME" could be any legal dir name on Unix system, e.g. 20120829-image. While "DEVICENAME" is the disk device name on Linux system, e.g. "sda" (1st disk), "sdb" (2nd disk)... In order to make Clonezilla more automatic, we have reserved some words for "IMAGENAME" and "DEVICENAME".

For image name

Four reserved names have special meanings, i.e. "ask_user", "autoname", "autoname-*", "autohostname", and "autoproductname".
  • ask_user:
    • In the saving mode, when "ask_user" is used as the "IMAGENAME", ocs-sr will let your user to enter the image name.
    • In the restoring mode, when "ask_user" is used as the "IMAGENAME", ocs-sr will popup the dialog for your user to choose the image name. Therefore please make sure there is at least on image dir exists in your image repository.
  • autoname:
    • This reserved word "autoname" is only for the saving mode, and it will automatically create an image name based on the MAC address of network card on the machine and the date and time. If no network card, UUID from the motherboard will be used. The image name is like: 005056001101-2012-08-30-1509-img (005056001101 is the MAC address of netork card "00:50:56:00:11:01" where ":" is removed).
  • autoname-*:
    • This reserved word "autoname-*" is only for the saving mode, and it supports customized auto-gen image name. Key name: productname, FQDN, UUID, MAC, year, date, time,month, day, hour, minute (case insensitive, but have to be all lowercase or uppercase). It can be any combination, just make beginning with "autoname-". If key name is not any one of the above, it will be shown as itself. E.g., (1) autoname-fox-year-date-time-uuid will create an image name like: fox-2020-1227-2336-564d41fc-9d80-20ac-c844-bda6a392d4c6. (2) autoname-tiger-month-day-year-hour-minute will create an image name like: tiger-12-31-2020-23-15.
    • In addition, datefmt_* can be used to assign the time, and its format is from "date" command. E.g., (1) autoname-fox-datefmt_%Y%m%d will create an image name like: fox-20210109. (2) autoname-fox-datefmt_%Y-datefmt_%m%d will create an image name like: fox-2021-0109.
  • autohostname
    • This reserved word "autohostname" is only for the saving mode, and it will automatically use IP address of network card to get the FQDN from DNS server, then append the date and time. For example, if the IP address is 8.8.8.8, the FQDN is google-public-dns-a.google.com, then the image name will be google-public-dns-a.google.com-2012-08-30-1509-img. If it's private IP address, no FQDN is available, then the name "autohostname-$IP" will be used, e.g. autohostname-192.168.120.2-20120830-1512-img.
  • autoproductname
    • Both in the saving and restoring modes, when "autoproductname" is used as the "IMAGENAME", Clonezilla will use dmidecode command to get the system-manufacturer and system-product-name then combind them with "-img" appended. E.g. the system-manufacturer is "ASUSTeK Computer INC.", while the system-product-name is "BM6875_BM6675_BP6375", then the image name is "ASUSTeK_Computer_INC_BM6875_BM6675_BP6375-img". Therefore the "autoproductname" scenario is for you to save the image of a type of machine, and restore it based on the model.

For device name

Some reserved names have special meaning for the device name, i.e. "all", "ask_user", PTUUID, SERIALNO, PARTUUID, and UUID:
  • all: In the saving or restoring mode, when "all" is used in the "DEVICENAME", ocs-sr will automatically find the non-busy (unmounted) device as the device name, e.g. sda, sdb... (for "savedisk"/"restoredisk" mode), and sda1, sdb1... (for "saveparts"/"restoreparts" mode). Of course, when using this in the restoring mode, you have to make sure the number of umounted disks/parts match the one in the source image. If the number does not match, then the execution might fail.
  • ask_user: In the saving or restoring mode, when "ask_user" is used in the "DEVICENAME", ocs-sr will pop-up a dialog for your user to input or choose the device name, e.g. sda, sdb... (for "savedisk/restoredisk" mode), and sda1, sdb1... (for "saveparts/restoreparts" mode).
  • PTUUID, SERIALNO, PARTUUID, UUID (case insensitive, but have to be all lowercase or uppercase): When ocs-sr is in saving mode, the DEVICE name can also be assigned by: For disk: PTUUID or SERIALNO, e.g., PTUUID=03c8b280-27aa-3881-aca5-9b9c66fe28c7; SERIALNO=WD-WCC2U2500581. If there are spaces in SERIALNO, replace every space by "_". For partition: UUID or PARTUUID, e.g., UUID=0b51ce79-7bc0-4111-8a40-839461a9b12f"
    In addition, for ocs-sr, destination disk can be assigned by serialno when restoring. For ocs-onthefly, source and destination device can be assigned by serialno.