TASIOMIND.DEV — OPERATIONAL▸▸▸FULL STACK DEVELOPER @ GWQ SERVICEPLUS AG▸▸▸FOUNDER — K8SGPT.AI▸▸▸OPEN SOURCE: ACTIVE▸▸▸DISTRIBUTED SYSTEMS / KUBERNETES / AI▸▸▸RUST + GO + PYTHON▸▸▸FIELD TESTED / STATUS — NOMINAL▸▸▸LOCATION: EUROPE/BERLIN▸▸▸TASIOMIND.DEV — OPERATIONAL▸▸▸FULL STACK DEVELOPER @ GWQ SERVICEPLUS AG▸▸▸FOUNDER — K8SGPT.AI▸▸▸OPEN SOURCE: ACTIVE▸▸▸DISTRIBUTED SYSTEMS / KUBERNETES / AI▸▸▸RUST + GO + PYTHON▸▸▸FIELD TESTED / STATUS — NOMINAL▸▸▸LOCATION: EUROPE/BERLIN▸▸▸

Copy one partition to another in Ubuntu Linux

February 23, 2024

NOTE: Following are just for copying one partition from another, they don't discuss generating new UUID and editing fstab that you will have to do if you want to change the mount points

With rsync

code
sudo rsync /home/. /media/home/.

If you want to exclude some files, you can add them with the --exclude= flag, for example: --exclude='/*/.gvfs'

code
--exclude=PATTERN        exclude files matching PATTERN
--exclude-from=FILE      read exclude patterns from FILE

Check that the copying worked:

code
sudo diff -r /home /media/home -x ".gvfs/*"

With dd

code
sudo dd if=/dev/sdx1 of=/dev/sdy1 bs=64K conv=noerror,sync

/dev/sdx1 is the source partition (input) and /dev/sdy1 is the destination (output)

  • if provides input file (instead of the standard input)
  • of provides output file
  • bs means block size
  • noerror means do not stop processing on an input error

With gparted

In the GParted GUI, right click on the drive and select Copy, then right click on the drive where you want to copy to and select Paste