Bash wrapper for creating and restoring backups of entire disks (partition table and filesystems) using the partclone utility. The script supports creating backups as compressed (.tar.gz or .tar.xz) or uncompressed (.tar) archives.
- Backup entire disks including partition table as tarballed partclone images
- Excludes blank filesystem space (partclone feature)
- Create a compressed or uncompressed archives
- Restore partition table and contents from a previously created archive
- Support for btrfs, ext2, ext3, ext4, reiserfs, xfs, fat and other common filesystems supported by partclone
disk-backup <operation> <disk> <archive_filename>
backup
: Create a backup archive from the specified disk.restore
: Restore partitions from the specified archive to the disk.
Create a compressed backup archive:
# ./disk-backup backup /dev/sdX backup.tar.xz
Create an uncompressed backup archive:
# ./disk-backup backup /dev/sdX backup.tar
Restore partitions from an archive:
# ./disk-backup restore backup.tar /dev/sdX
-
partclone
-
parted
-
sfdisk
-
xz (for .tar.xz archives)
-
gzip (for .tar.gz archives)
- Clone the repository:
git clone https://github.com/abraarsameer/partclone-disk-backup.git
- Make the script executable:
chmod +x disk-backup
- (Optional) Copy/Symlink the script to
/usr/local/bin/
for system-wide access, or to~/.local/bin/
for local user access.
The restore operation will overwrite all existing data on the specified disk. Use with caution.
Use this script at your own risk. The author(s) are not liable for any data loss or damage caused by its use.
This script is released under the MIT License.
Contributions are welcome! Please open an issue or submit a pull request.