Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
you must not archive /dev. I mean never ever. You always need to use the mount point. Otherwise would be nice to know what are you trying to achieve again, what errors did you get...
(ok, there can be some exceptions when you want to access /dev/something, but in that case you need to know exactly what are you doing).
Backing up a running system can be problematic. Best to use a livecd, mount the partition you want to backup, cd to that partition mount point and run:
Code:
$ sudo tar --acls -czvpf /<path to backup location>/backupfile.tar.gz .
Note, always use tar as root or use sudo for this backup. Some files are readonly by root and will be missed in your backup(permission denied) if you do not have admin privileges. Also note the "--acls" flag. Most modern linux distros use acl permissions for some purposes. Without this flag, tar will not pick up those acl permissions. Most modern distros have a recent enough version of tar that can handle acl permissions if you use the "--acls" flag. Note also the trailing period at the end of the above line of code. That tells tar to archive the current directory and needs to be there.
To restore from such a backup, again, use a livcd, mount the partition you want to restore, delete all the contents of the partition, cd to the partition mount point and run:
Code:
$ sudo tar --acls -xzvpf <path to backup file>
Note, do not reformat the partition instead of deleting the files as reformatting will change the uuid of the partition messing up your fstab and grub.
If you want to back up a root or system partition then don't unless you are using a live state backup. I think fsarchiver does it live state. As above a few issues.
A data only partition is what tar or some gzip sort of deal is for.
If you want to make an image of the working partition then boot to some live media maybe.
A backup system based on rsync is far superior to tar backups or dd backups. If you create a backup system based on tar or dd be sure to run some restore tests for a bare metal restore, restoring a previous version of a single file, and restoring a file that was deleted a few days before the current backup was run.
No matter what backup system you create you don't need to backup /sys or /dev because you will never restore them.
#1 Rsync is not backup software, it is an application for file and folder syncronization.
#2 Tar makes Tape ARchives, and is not backup software. Tar can be used to archive files and folders.
#3 A tool that can sync or archive files and folders can be a useful, even critical, PART of a backup and recovery plan or strategy.
----
If what you want to back up is a partition, then what you need is a tool that creates an archive, copy, or clone of a partition: not just files or folders!
I have used mirroring for backups: make and sync a mirror, break the mirror, and archive with compression the idle and going stale copy of the mirror. That was like magic to remove downtime during backups while ensuring they were consistent back in the day: I no longer recommend that. We have smarter tools now.
For your purposes a true backup tool would be preferred, and if you want partition backups then a tool specific to partitions might serve best. PArtimage and clonezilla come to mind at once.
I use lvm snapshots via script. Create snapshot, tar snapshot to external drive. remove snapshot when done. automatic. That + timeshift hourly and I've nary an issue.
#1 Rsync is not backup software, it is an application for file and folder syncronization.
#2 Tar makes Tape ARchives, and is not backup software. Tar can be used to archive files and folders.
#3 A tool that can sync or archive files and folders can be a useful, even critical, PART of a backup and recovery plan or strategy.
----
PArtimage and clonezilla come to mind at once.
Reading through replies I have not commented because I have a lot to learn.
The need for byte-for-byte backup is something that has always perplexed me, as source & destination are rarely equivalent media & motivate circumspection. I notice in Linux problems with symlinks but at least we don't have hidden system files to worry about like Redmond (the difference between copying & a real 'backup').
I confess only tinkering with dd while relying Windows builtin backup & AOMEI Backupper. If I could do the same thing in Linux I would.
Virtually every Linux distribution that has a repo system has backup and imaging tools in the repo: those are the backup and recovery and imaging tools native to Linux. Perhaps searching your repo will provide you some places to start your research, and all of the tools you need for your purpose.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.