• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Backing up Linux Partitions

Some of you may know that I am relatively new to Linux. Like all good beginners, I have managed to "personalize" my operating system to the point of breaking, a few times now. From research, the recommended fix is to do a clean install. This is not a big deal as I keep my personal data safe on a non-Linux partition at least for now. I am curious though, After a fresh install, I thought I could copy and paste my root partition to a safe place. In the event I over-tweak again, I could just copy over the offending directory as a pseudo-factory reset. I tried but not all files will copy even as root. I figure its either due to the file being in use or some sort of encryption. My questions are.

!. Will a restore like this even work?
2. If yes, Can I copy everything while in a live session?
3. Is there an easier way?

I'm used to Android and having a Nandroid back-up is nice for peace of mind.
 
How are you doing this partition copying? If you were using a GUI file manager (indicated by when you stated, "...copy and paste my root partition...) and the resulting backup was missing files it sounds like the file manager wasn't set to view hidden files? Generally using a file manager to clone a system partition generally isn't a workable solution.

A more reliable way would be to clone your root partition using a terminal. At that point you can use the 'dd' command, here's a nice summation on using dd. There are options that apply to different situations, pick the one that suits your needs.
https://wiki.archlinux.org/index.php/disk_cloning
An advantage when using something like dd is if it encounters an error you'll be able to just read the messages -- i.e. if some files are corrupt or skipped, their names will be listed and you'll have documentation to investigate the matter.

If you prefer some kind of graphical interface, I like 'Clonezilla'. Create a Clonezilla CD or bootable flash drive and when you boot up into the Clonezilla you can clone partitions or entire drives (even dual-boot drives with multiple format partitions), or make disk image files.
http://clonezilla.org/
 
Great, I appreciate it. I was using Nemo to copy and paste. I am starting to learn that what cannot be done with GUI can always be done with CLI. Problem is that's how I seem to get in trouble. Pasting some errant command line I find on the internet without fully understanding what it does. I will have to be more careful. For the time being, I will just clone the partition while I learn. Thanks.
 
Yeah, unfortunately just copying random commands off the Internet has become more of an issue the past few years, we just can't ignore there's always an a-hole out there who has no guilt at screwing over others. Posted articles generally aren't too bad, it's the reader comments that can often be littered with some pretty nasty stuff. If you do run across some command string online that makes you think twice about, there's always the man (manual) pages that are integral in any Linux distro that you can refer to for confirmation. Open a terminal and if you type in 'man dd' you'll get a description plus all the extra, conditional flags for the dd command.

You might also want to look into the rsync command. (type 'man rsync' will give you a flood of relevant info)
http://www.tecmint.com/rsync-local-remote-file-synchronization-commands/

Or, again if some kind of GUI is preferable, take a look at Grsync.
https://en.wikipedia.org/wiki/Grsync
 
it's the reader comments that can often be littered with some pretty nasty stuff.

Hit the nail on the head there. Backtracking to find what went wrong is difficult too. I've literally got over 100 bookmarked pages. Trying to find 1 comment in that. What a headache.
 
If you're trying to diagnose some inadvertent goof-up you might have made (as we all do), some programs might include a menu selection to access its log file so that might be the first thing to check.
But again, using a terminal has its advantages. Your command history can always be revealed just by typing the up and down arrows on your keyboard.
- You can also just type in 'history' to see a listing of the last 500 commands you've typed in.
- If there's a specific command string you can kinda, sorta recall but not fully, hit the Ctrl and r keys and the prompt should change to
(reverse-i-search)`':
Type in the first few letters of the command and hopefully you'll find what you're looking for without having to scroll through a long listing.
 
Back
Top Bottom