Thanks to visit codestin.com
Credit goes to github.com

Skip to content

lubobde/backup-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 

Repository files navigation

Smart USB Clone Script

A smart, interactive Bash script designed to clone bootable USB drives efficiently.

Unlike standard cloning tools that copy every single byte of a drive (including empty space), this tool calculates exactly where your data ends and copies only the used partitions. This allows you to clone a large source drive (e.g., 128GB with only 7GB of data) onto a smaller target drive (e.g., 16GB), provided the data fits.

πŸš€ Features

  • Smart Size Calculation: Automatically detects the end of the last partition to avoid copying empty space.
  • Interactive Workflow: Prompts you to insert the target drive only when needed, reducing the risk of overwriting the wrong disk.
  • Safety Checks:
    • Verifies root privileges.
    • Prevents cloning if Source and Target are the same device.
    • Calculates if the Target drive has enough physical capacity before starting.
  • Universal Compatibility: Works with both Legacy BIOS (MBR/DOS) and UEFI (GPT) partition schemes.
  • Auto-Repair: Automatically fixes GPT backup headers on the target drive using sgdisk if necessary.

πŸ“‹ Prerequisites

You need a Linux system with the following standard tools installed:

  • bash
  • parted (for partition analysis)
  • lsblk (for size detection)
  • dd (for the actual copying)
  • gdisk (provides sgdisk for GPT repairs)

Installation on Debian/Ubuntu/Kali:

sudo apt update
sudo apt install parted gdisk

About

script for safely and efficiently creating byte copies of USB sticks

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages