Appropriate command to copy everything in root "/" to an external storage volume?

To add to what P.P has said, you don't really want to copy every directory. I use tar to backup everything that I need, and "exclude" the directories I don't need. The command basically goes tar (options) BACKUP-FILENAME TARGET. If you run the following command it should do the trick.

sudo tar -cvpzf /media/username/TOSHIBA\ EXT/root_copy/root-copy.tar.gz --exclude='/mnt' --exclude='/run' --exclude='/proc' --exclude='/sys' --exclude='/media' --exclude='/dev' --exclude='/lost+found' --exclude='/tmp' --exclude='/boot' --exclude=".*lost+found" / 2> /root/tar-errors.txt

I know it looks like a lot, but tar is going to create a backup at /media/username/TOSHIBA\ /EXT/root_copy/. The file name is root-copy.tar.gz. It will exclude each of the directories that I have mentioned with --exclude, and lastly it will dump any errors that occur in a file named /root/tar-errors.txt.

Another benefit to using tar this way, is that the backup file will be a "zipped tarball". It's essentially a compressed archive so you will save space on your external drive.

I am sure there are more simple ways of doing this but I have always used this method to backup my systems.


Yes, if you want to copy everything under /, then you can do:

sudo cp -r / media/username/TOSHIBA\ EXT/root_copy/

But, before proceeding... you need to be aware that you don't really want to copy everything under / :)

You typically only need to copy your data; not all the OS binaries, installed applications, configuration files, etc. Which is what the about command would do.

If OS upgrade goes bad, it's not going to be straightforward to "copy over" everything. If you had your data, you can simply reinstall the OS and copy back the data from the external disk/medium.

Also, if you have set up other partitions than the one you have the OS installed and keep the data there, then you may not need to copy externally at all. You can keep your data in a separate partition. If the OS reinstall goes bad, you can just wipe that partition and reinstall the OS without touching the other partition where you kept the data.


Consider imaging the disk instead of making just a copy of files. There's more than just files that can get messed up during an upgrade: EFI system partition, boot sectors etc.

I'd recommend Clonezilla. It's user-friendly and reliable. They have their dedicated boot disk. Some rescue disks provide it too (eg. GRML) and you can install it on Ubuntu Live CD.

Clonezilla images aren't browseable, but can be used to easily restore entire disk to previous condition.

Some people could suggest using dd to create a raw image. It's also a valid approach and resulting files would be browseable, but they would take as much space as your entire partition size. Meanwhile Clonezilla uses partclone under the hood, which only copies actually used disk space and ignores free space unlike dd. Clonezilla will also compress images by default.