My hard drive is failing and I want to back it up to an external hard drive. The problem is, my hard drive is partitioned and I don't know how to go about the back up in such a way that the external hard drive will be partitioned the same way as my current one
You can use dd to back up the entire hard drive including the partition table.
BE CAREFUL WITH THIS COMMAND, AS YOU CAN EASILY OVERWRITE VALUABLE DATA!
To back up FROM an internal hard drive TO an external hard drive, you would run this in a terminal window:
dd if=internal-hard-drive-device-name of=external-hard-drive-name
where hard-drive-device-names are something like:
/dev/sda
/dev/sdb
/dev/sdc
etc...
If your hard drive is /dev/sda, and it has partitions /dev/sda1, /dev/sda5, /dev/sda6, the partitions ending in numbers don't matter if you are backing up the ENTIRE hard drive. All you need use is the first part, without any number, which in this example is /dev/sda.
So if your internal hard drive is /dev/sdb and your external hard drive is /dev/sdd, you would type: (please note you MUST figure out what YOUR device names are)
You can use the already installed program called Disks to figure out what your hard-drive-device-names are. Search for Disks in the Unity Launcher, and run it. Then plug in you external hard drive, and take note which device name gets assigned to it. You can do this by clicking on one of it's partitions, and looking for the part that starts with /dev/. You can also click on the other devices in the left column, and figure out which one is the internal hard drive you want to back up.
Of course, the backup hard drive would have to be as large, or larger, than the failing hard drive. If the backup hard drive is larger, you will only see the size of the failing hard drive when you mount the completed backup. This is because the partition table gets copied over, just like you wanted. You can resize partitions using GParted if you feel the need.
You can also save the backup hard drive to an image file by typing this:
dd if=internal-hard-drive-device-name of=NameOfHardDriveBackupFile.img