How to back up a partition using the “parted” command.
To back up a partition, you can use the parted command to perform the following steps:
- Firstly, run the following command to see all partitions on the system:
sudo parted -l
- Select the partition you wish to back up. Pay attention to the name and size of the partition to avoid backing up the wrong one.
- Run the following command to back up the selected partition. Replace /dev/sdX with the actual name of the partition you want to back up, and replace backup.img with the location and filename where you want to save the backup:
sudo parted /dev/sdX --align=opt mkpart primary ext4 0% 100%
sudo dd if=/dev/sdX1 of=backup.img bs=4M status=progress
The above command will create a new partition identical to the original partition and copy its content to the backup.img file.
Please note that backing up a partition may take some time, depending on the size of the partition and the computer’s performance.
- image file for backup