Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
I am new to linux so I would like to know how to work with partitions and backing up and restoration of Linux. Which are the best tools available for this??
I am using linux Mint
depends on your specific needs. it looks like the arch wiki, etc., have a large number of options.
personally i'm a command line purist, so I use parted to work with partitions. for backups, cron runs a weekly script that tars my important files and mails them to a computer in my living room. obviously, this wouldn't be appropriate for administrating a multi-user network.
a few hints if you go the scripting route:
- you can check what is using up space on your computer with sudo du -h --max-depth 1 /
an easy way to back up most of the important files is to tar and xz /home and /etc if they are small enough (though this is unlikely if you have, for example, a big .cache folder in your home directory used for your browser, etc.)
- you can run dpkg --get-selections > packages.bak to save your package selections to a file, then restore them with dpkg --set-selections.
- you can check if a file has been changed or modified before replacing it to save some space/bandwidth
Last edited by crazy-yiuf; 11-28-2015 at 11:30 PM.
I use rsync (comes with most Linux distros). It is super fast and you can copy your backup to a new system/partition. The partition doesn't have to be the same size or larger (as is the case with dd which is another way to backup your system).
You can learn all about its use from the archwiki website: https://wiki.archlinux.org/index.php...kup_with_rsync
You need to use terminal, but as you see the command is not that complicated. I would suggest using
Code:
# rsync -aAHXv . . .
instead of just -aAXv because I ran into troubles with the latter: my package manager complained that there were multiple duplicate files and wouldn't work when I copied the rsync files to a partition on a laptop.
To back up your /home, you would issue another rsync command (the command mentioned above is for the entire system). Here is
an example of a /home backup:
Code:
rsync -a --info=progress2 --exclude={"/Videos/*","/.cache/*"} /home/your-user-name/ /path/to/backup/media/
Inside the exclude= brackets you can list any directories and their subdirectories that you don't want/need to copy. "/.cache/ and its subdirectories are not necessary for a backup. My Videos directory contains a lot of videos that I play using Plex Media Server. It would require a lot of copying, and I wouldn't be upset if I lost them (I can easily repopulate the directory with other videos).
It is advisable to copy your root ("/") files separate from your /home files since if you bork your system, you would only have to use the backup for root to get it up and running again which would save you time.
It took 25 minutes to copy my root files with rsync, and 17 minutes to copy my /home files. And it took the same amount of time to copy the rsync backup files to a new partition.
Another possibility is to use dd to backup each of your partitions. Here is a clear explanation from Arch Wiki: https://wiki.archlinux.org/index.php/Disk_cloning
This is a bit easier than rsync but if you are not careful (if you put the partition/path that you are copying to before the partition that you are copying from), you will have to reinstall your system.
dd comes on virtually all Linux distros.
You can also use Clonzilla which more or less guides you through the process (I believe it is a type of GUI and utilizes dd).
You would use your package manager (dnf, aptitude, apt-get, pacman, etc) to install it. It is just as time-consuming as dd is -- it can take over an hour to copy a partition.
You can use all three on any Linux distro and you can even use them on Windows and Mac.
Hi
I am new to linux so I would like to know how to work with partitions and backing up and restoration of Linux. Which are the best tools available for this?? I am using linux Mint
The best tool for working with partitions is the Gparted program.
It is already installed on your live Linux Mint DVD or USB. However, it is not installed by default when you install Mint to the hard drive. So you have to install it with this command:
When you ask about backing up and restoring Linux, you have to be more specific. Are you thinking of backing up your operating system? Or just talking about backing up your personal data?
For backing up personal data, you can learn to use the rsync commands, or tar commands. But my personal choice is the grsync program.
Code:
sudo apt-get install grsync
With grsync, once you have it configured, you just plug in your USB backup drive, open the program and click "Run", and that's it - DONE.
Last edited by TxLonghorn; 11-29-2015 at 08:28 AM.
I am new to linux so I would like to know how to work with partitions and backing up and restoration of Linux. Which are the best tools available for this??
I am using linux Mint
thanks
kk
If you have an external drive the same size or slightly larger you can prepare and boot a distro called Clonezilla Live and perform Ghost-like backups of the entire system, partitions and all.
Otherwise...
For basic, frequent backups, I use a file synchronization tool and external storage. My favorite is Freefilesync, which works and looks the same in Windows as it does in my Linux distros of choice. If you can't find or install that, there are a number of front-end GUIs for rsync. grsync is pretty good. The first backup takes a long time depending on how much data you have. Subsequent backups are differential-incremental and go very fast.
For settings, I like to take my Firefox settings with me. Just show hidden files and folders in home. The hidden folder .mozilla can be copied somewhere and restored to its new home.
Additionally, as a second line of defense, make a full backup of home using duplicity and its front-end deja-dup.
For application reinstallation your package manager can save a list of current programs for one-shot reinstallation (exception->software from PPAs).
Last edited by KernelTainted; 11-29-2015 at 02:07 PM.
+1 Clonezilla for backing up an entire drive or partition, especially once all the programs wanted are installed and configured as desired. It takes but a short time to get used to its workings and many images may be backed up on a USB device. Many times I have gone back to a stored image after a failed dist-upgrade or a screwed up system for one reason or another.
I noticed my example of rsync backup of /home is incomplete. I forgot to include and name the directory where the backup directories/files will be placed (otherwise they will be scattered among other files/directories).
Here is a corrected command:
Code:
# rsync -a --info=progress2 --delete --exclude={"/Videos/*","/.cache/*"} /home/name-of-user/ /path/to/backup/media/Rsync-home-backup-Dec2015/
You won't have to actually create this directory (/Rsync-home-backup-Dec2015); rsync does it for you. Just make sure you run the rsync command as super user or with "sudo". If not, rsync will stop, complaining that it lacks privileges to create directories or copy files. This is especially true when you run a full-system backup with rsync.
Notice the --delete option. You would add this option so that when you run the backup later (weekly,daily,etc.), rsync would only add/delete what has changed. Also notice that the directories that you are backing up and the directory where you are storing the backup must end in a forward slash (/).
rsync gets my vote as it is very flexible, you might want to think about how you use the "--exclude-from=" option.
If you want restore it to a fresh install (because the original is foobared) then the new install will have its own set of . files, possibly different from those on your original, so write an exclude file to include all of those.
+1 Clonezilla for backing up an entire drive or partition, especially once all the programs wanted are installed and configured as desired. It takes but a short time to get used to its workings and many images may be backed up on a USB device. Many times I have gone back to a stored image after a failed dist-upgrade or a screwed up system for one reason or another.
agree with Clonezilla, clone the machine or server with Clonezilla.
Then do rsync backup for folders that keeps updating.
If the server or machine goes south, restore the clone to a new VM or hardware then do an rsync for the latest backup and keep on going.
I used Clonezilla to clone a 10 year old server and restore to VM and works just fine.
Last edited by JJJCR; 11-30-2015 at 02:05 AM.
Reason: edit
Also notice that the directories that you are backing up and the directory where you are storing the backup must end in a forward slash (/).
This is not correct. Here is the exact command created by grsync and used to back up my personal data from /home/dan/sdb2_data/MyStuff to /media/dan/sdd2_413gb/MyStuff
It works fine with no slashes at the end.
This is not correct. Here is the exact command created by grsync and used to back up my personal data from /home/dan/sdb2_data/MyStuff to /media/dan/sdd2_413gb/MyStuff
It works fine with no backslashes at the end.
The backslash on rsync is very important. On the destination it doesn't matter, but on the source the backslash tells rsync to copy the contents of the directory, while the lack of a backslash tells rsync to copy the directory itself and its contents.
So neither using it or leaving it off is correct or incorrect, but it does change the behavior of the command, so you need to use the correct syntax for your application.
Yes, got it.
/home/suicidaleggroll copies /home/suicidaleggroll and all directories therein (when using -r).
/home/suicidaleggroll/ copies only all directories, but not /home/suicidaleggroll
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.