{"id":21424927,"url":"https://github.com/arkhipenko/clonezilla","last_synced_at":"2026-01-03T06:35:41.174Z","repository":{"id":239257755,"uuid":"798567725","full_name":"arkhipenko/clonezilla","owner":"arkhipenko","description":"Fully automated unattended backup using clonezilla","archived":false,"fork":false,"pushed_at":"2024-05-13T13:15:09.000Z","size":9,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T07:22:32.719Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arkhipenko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-10T03:17:01.000Z","updated_at":"2025-01-19T20:39:11.000Z","dependencies_parsed_at":"2024-05-11T03:27:44.258Z","dependency_job_id":"5a4f95b9-7668-4093-af49-0d37e672e6f4","html_url":"https://github.com/arkhipenko/clonezilla","commit_stats":null,"previous_names":["arkhipenko/clonezilla"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkhipenko%2Fclonezilla","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkhipenko%2Fclonezilla/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkhipenko%2Fclonezilla/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkhipenko%2Fclonezilla/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arkhipenko","download_url":"https://codeload.github.com/arkhipenko/clonezilla/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243933373,"owners_count":20370989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T21:25:37.117Z","updated_at":"2026-01-03T06:35:41.132Z","avatar_url":"https://github.com/arkhipenko.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Unattended automatic backup via Clonezilla bootable media\n\n## Background\n\nThe purpose of this repo is to build a fully automated backup solution using [Clonezilla](https://clonezilla.org/) engine.\n\nThe solution provides the ability to create backups of one/multiple partitions or one/multiple drives of a computer system in a completely unattended mode.\n\nThe system boots, determines what should be backed, where the backup should stored, then performs the backup and powers the equipment down.\n\n## How it works\n\nThe solution is based on the bootable clonezilla media.\n\nThe only user intervention is to boot the target computer into Clonezilla bootable media. The automatic process take over from there.\n\n  \n\n### Algorithm\n\n- Boot into Clonezilla\n\n- Automatically start Custom backup option\n\n- Inspect local partitions looking for `backup.conf` configuration file in the root folder\n\n- Compare hardware ID of the target hardware to the hardware ID in the `backup.conf` (correct backup configuration check)\n\n- Determine backup target partition (backup folder is created in the root folder on that partition)\n\n- Determine partitions or drives to be backed up\n\n- Execute the backup\n\n- Powerdown or reboot the target computer\n\n### Outcome\n\nThe resulting backup is created in a folder (folder name is supplied in the `backup.conf` file) on the backup partition (partition is supplied in the `backup.conf` file). Backup parameters are also supplied in the `backup.conf` file. Those are passed to Clonezilla engine at runtime.\n\n\n## Bill of Materials\n\nIn order to have a self-sufficient backup system, I opted to have a 2TB external USB HDD split into two partitions:\n\n  \n\n- Bootable Clonezilla partition with Clonezilla application and backup scripts\n\n- Data partition - where the resulting backup is stored\n\n  \n\n### You will need:\n\n- 2TB USB hard drive example is this: [Seagate Backup Plus Slim 2TB External Hard Drive Portable HDD](https://www.amazon.com/gp/product/B00FRHTTJE)\n\n- USB/USBC cable\n\n- A computer (this repo relies on you knowing Linux command line)\n\n  \n\n## Build process\n\n  \n\n### Partition hard drive\n\nPartition hard drive into 2 separate partitions:\n- FAT32 Clonezilla Partition - 512MB\n- exFAT Data Partition - 1.8T\n\nRelevant fdisk output for this disk is:\n\n    fdisk -l /dev/sdc\n    Disk /dev/sdc: 1.84 TiB, 2000398934016 bytes, 3907029168 sectors\n    Disk model:\n    Units: sectors of 1 * 512 = 512 bytes\n    Sector size (logical/physical): 512 bytes / 4096 bytes\n    I/O size (minimum/optimal): 4096 bytes / 4096 bytes\n    Disklabel type: dos\n    Disk identifier: 0xcb37c45a\n      \n    Device Boot Start End Sectors Size Id Type\n    /dev/sdc1 * 2048 1050623 1048576 512M b W95 FAT32\n    /dev/sdc2 1050624 3907028991 3905978368 1.8T 7 HPFS/NTFS/exFAT\n\n- Follow this setup guide to install Clonezilla on the first partition: [setup guide](https://clonezilla.org/liveusb.php)\n- Copy `custom-ocs` file from the `/clonezilla/live/` folder to the `/live` folder on Clonezilla partition\n- Navigate to the `/boot` folder on the Clonezilla partition\n- Backup `grub.cfg` files (e.g. `grub.cfg.bak`) in case you make a mistake\n- Edit the `grub.cfg` file making the following changes:\n\n 1. Set timeout to 5 seconds (default is 30):\n\n\t\tset timeout = \"5\"\n\n 2. Location this line (usually the first Clonezilla menu item):\n\n\t\tmenuentry --hotkey=r \"Clonezilla live (VGA 800x600 \u0026 To RAM)\" --id live-toram {\n\n 3. Copy the entire `menuentry` block ahead of the first menublock - the default menu item is 0 (first on the list)\n\n\t\tmenuentry --hotkey=r \"Clonezilla live (VGA 800x600 \u0026 To RAM)\" --id live-toram {\n\t\t  search --set -f /live/vmlinuz\n\t\t  $linux_cmd /live/vmlinuz boot=live union=overlay username=user hostname=noble config quiet loglevel=0 noswap edd=on nomodeset enforcing=0 noeject locales= keyboard-layouts= ocs_live_run=\"ocs-live-general\" ocs_live_extra_param=\"\" ocs_live_batch=\"no\" vga=788 toram=live,syslinux,EFI,boot,.disk,utils net.ifnames=0  splash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1\n\t\t  $initrd_cmd /live/initrd.img\n\t\t}\n\n 4. In the new block, modify the menuitem description and the boot command according to the following:\n\n\t\tmenuentry --hotkey=r \"Clonezilla Autobackup (VGA 800x600 \u0026 To RAM)\" --id live-autobackup {\n\t\t  search --set -f /live/vmlinuz\n\t\t  $linux_cmd /live/vmlinuz boot=live union=overlay username=user hostname=noble config quiet loglevel=0 noswap edd=on nomodeset enforcing=0 noeject locales=locales=en_EN.UTF-8 keyboard-layouts=NONE ocs_live_run=\"/lib/live/mount/medium/live/custom-ocs\" ocs_live_extra_param=\"\" ocs_live_batch=\"no\" vga=788 toram=live,syslinux,EFI,boot,.disk,utils net.ifnames=0  splash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1\n\t\t  $initrd_cmd /live/initrd.img\n\t\t}\n\n 5. Save `grub.cfg` file\n\nThe autobackup setup of Clonezilla is now complete.\n\n### Prepare target computer\n\n#### Backup configuration file\nBackup configuration file tells automatic Clonezilla what kind of backup needs to be performed.\nIt should be localed in the root folder on one of the drives of the target computer:\n\n\t\t/backup.conf\n\nA sample backup file is below:\n\n\t\t4c4c4544-0054-3610-804a-c7c04f444b33\n\t\t7B0DFCE74B228860\n\t\t-q2 -j2 -nogui -z1p -i 2000000 -p poweroff savedisk xps15dev_system\n\t\tD2DE19FADE19D815\n \nLet's review it line by line\n\n##### Line 1 - hardware ID of the target machine:\n\n\t\t00020003-0004-0005-0006-000700080009\n\nThis ID could be looked up with this command: `sudo lshw -quiet -class system | grep configuration | grep uuid`\n\n\t\t$ sudo lshw -quiet -class system | grep configuration | grep uuid\n\t\tconfiguration: boot=normal chassis=desktop family=Default string sku=Default string uuid=00020003-0004-0005-0006-000700080009\n\n\nThe easiest way to build `backup.conf` file is to boot into interactive Clonezilla, drop into shell instead of starting the backup and look it up there. \nClonezilla checks if correct configuration file has been found and ignores the ones with unmatched hardware IDs\n\n\n##### Line 2 - UUID of the partition to store back up file on\n\n\t\t7B0DFCE74B228860\n\nIf the target computer has mulitple disk drives, you can specify on of the partitions on the drives that are not part of the backup.\nTypically this is the partition UUID of the DATA partition of the 2TB backup drive we are building.\nNote that `7B0DFCE74B228860` is UUID of an exFAT partition (windows). Linux ext4 partition UUID will look like `38d9e8cd-deda-4735-ad97-a795665e77fe`\nYou can look up partition UUIDs using `sudo blkid` command.\n\n\n##### Line 3 - Clonezilla command line arguments\n\n\t\t-q2 -j2 -nogui -z1p -i 2000000 -p poweroff savedisk xps15dev_system\n\nOne by one:\n\n- `-q2` is to use partclone to save partition(s) (i.e. partclone \u003e partimage \u003e dd).\n- `-j2` is to use dd to clone the image of the data between MBR (1st sector, i.e. 512 bytes) and 1st partition, which might be useful for some recovery tool.\n- `-nogui` is to disable fancy graphical progress reporting and stick to simple text only output\n- `-z1p` is compression method using parallel gzip program (pigz) when saving: fast and small image file, good for multi-core or multi-CPU machines.\n- `-i 2000000` is to set the size in MB to split the partition image file into multiple volumes files.\n- `-p poweroff` is to shutdown the target computer after backup.\n- `savedisk` is command to backup the entire drive (`saveparts` saves individual partitions).\n- `xps15dev_system` is the name of the target folder for the backup.\n\nThe esiest way to build this line is to run an interactive Clonezilla session, select all desired parameters and save the resulting command line.\nThere is also a command line reference here:  [Man page of ocs-sr](https://clonezilla.org/fine-print-live-doc.php?path=./clonezilla-live/doc/98_ocs_related_command_manpages/01-ocs-sr.doc#google_vignette)\n\n##### Line 4, 5, 6 and so on\n\n\t\tD2DE19FADE19D815\n\nLines 4 onward list UUID of partitions being backed up. \nIf you are using `savedisk` command - any partion on a disk will make Clonezilla backup the entire disk.\nIf you are using `saveparts` - you need to specify each partition separately\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farkhipenko%2Fclonezilla","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farkhipenko%2Fclonezilla","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farkhipenko%2Fclonezilla/lists"}