LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices


Reply
  Search this Thread
Old 07-02-2005, 07:26 AM   #1
une
Member
 
Registered: May 2004
Location: Australia
Distribution: Mandrake 10, Puppy Linux 2.13
Posts: 201

Rep: Reputation: 30
Backing up /home


I'm not sure how to ask this question but I will plod on. I'm feeling my way into a train of thought.

I want to backup all the files in /home in case my hard drive ever implodes or I want to use it in connection with a second Linux distro. I want to preserve all the user files including all Mozilla, KDE, Gnome and any other user related files (are they ALL in /home ?).

For example can I burn /home to a DVD, then on a new distro on another hard disc just copy the DVD contents to / and voila, I'm up and running as before with all the user settings and files in place? Is it that simple?

I have heard you should locate your /home directory on its own partition, then if your OS implodes you can reinstall and your /home is untouched ready for re-use. Is this a good way to go and how do you do this? Does configuring your OS in this way change the way the OS interacts with /home?
Any references or comments appreciated.
 
Old 07-02-2005, 08:12 AM   #2
musicman_ace
Senior Member
 
Registered: May 2001
Location: Indiana
Distribution: Gentoo, Debian, RHEL, Slack
Posts: 1,555

Rep: Reputation: 46
I want to preserve all the user files including all Mozilla, KDE, Gnome and any other user related files (are they ALL in /home ?).
Quick answer is yes, they are likely in /home/username/.Mozilla/
If you do an ls -a, it will show you quite a few more files and directories under your home. It is probably a good idea to export your favorites to a file just in case.

For example can I burn /home to a DVD, then on a new distro on another hard disc just copy the DVD contents to / and voila, I'm up and running as before with all the user settings and files in place? Is it that simple?
I doubt it will be that simple. Whatever utility you use for burning, when you highlight /home and drag it to the new CD/DVD, your only highlighting the files that are not hidden. all the files beginning with a dot (.) will most likely be omitted. If you created a tarball of /home with the correct switches, you could achieve what I believe you are looking for.

I have heard you should locate your /home directory on its own partition, then if your OS implodes you can reinstall and your /home is untouched ready for re-use. Is this a good way to go and how do you do this? Does configuring your OS in this way change the way the OS interacts with /home?

Everyone has there own reasons for mounting directories on their own partitions. I'd agree that /home should be mounted its own partition. I'm also glad you referenced the fact that it will only be benificial if the OS dies.
You would go about doing this by partitioning your hard drive before installing your distrobution. You should get an option, possibly only if you chose 'expert installation', to partition and set mount points. You should be required to create 2 partitions, a swap and the / partition. Beyond that, /home, /usr, /boot are typically ones I mount on separate partitions. /var if the system is a server of some type. If you have extra hard drives, you can add the hard drive, move the files from /home to the new hard drive, and set the mount point of /home to the new hard drive in your /etc/fstab.
 
Old 07-02-2005, 08:19 AM   #3
Bebo
Member
 
Registered: Jul 2003
Location: Göteborg
Distribution: Arch Linux (current)
Posts: 553

Rep: Reputation: 31
Hello,

It should be ok to just copy the whole of /home to a DVD or something and then copy the lot to another harddrive. Just make sure that the user directories are the same on both systems. The user's home dirs are set in /etc/passwd. When you copy /home to the other system, make sure they end up in that system's /home so that the user files don't end up in /, which would be a pain to clean up.

All the user settings (not the system settings, which are usually in /etc) are contained in hidden files (like for instance the directory /home/a_user/.kde) in each user's home directory, so these would be transferred as well if you take care to include these "dot-files". Making a recursive copy of /home should do this, or a with a tar-ball, tar cf home.tar /home . However, if the first system uses for instance KDE 3.4 and the other system uses some other KDE version, then the configurations might not be compatible with each other, but as long as you're using the same program versions on both systems it should be no problem. In this KDE example, the worst case would be that you'd have to remove the /home/a_user/.kde directory, and let KDE set its own default configuration, after which you can configure it again.

Letting /home be on a partition of its own is good practice, since it makes it relatively easy to upgrade your systems without touching the user's data. The system in itself doesn't care about whether /home is on a partition on its own or not, the only thing you have to remember is to have an entry for /home in /etc/fstab if /home has its own partition.

Partitioning can be done with a number of tools. I like to use Partition Magic, which is proprietary, but GNU/Linux systems also have a plethora of these programs; parted, fdisk and cfdisk comes to mind.
 
Old 07-02-2005, 08:34 AM   #4
uberNUT69
Member
 
Registered: Jan 2005
Location: Tasmania
Distribution: Xen Debian Lenny/Sid
Posts: 578

Rep: Reputation: 30
Having a separate home partition is the best way to go.
You should set this up when first partitioning you drive during the
install phase, however it is possible (given enough free space, etc)
to chop and change things around afterwards.
This is most easily done with a live cd (my personal favourite is DFS - Debian From Scratch) as it has LVM2 capability.
LVM is pretty nifty as you can change the size of your 'partitions' (ie. logical volumes) as your needs change and also take instant snapshots of complete volumes for backup while the system is running!

The simplest way of making a backup of a separate home partition (let's say the partition is hda6):
#dd if=/dev/hda6 of=~/hda6.ext3.img
... assuming you have enough room in /root/ !!
That command will copy the whole partition, filesystem and all.
If the image is over 4.3GB (for a single-layer burner) you might like to look into gzip and/or split.

If you'd prefer to work at the filesystem level (eg. your home is not separate!) then tar can help you out.
To create an archive:
#tar -cjf ~/myhome.tar.bz2 /home
or
#tar -czf ~/myhome.tar.gz /home
depending on your choice of bzip2 or gzip compression

To unpack:
#tar -xjpf ~/myhome.tar.bz2 -C /
or
#tar -xzpf ~/myhome.tar.gz -C /

(I think that's about right! )


I'm not sure about your last question, but a couple of things come to mind:
- You need an entry in /etc/fstab to make sure your home is mounted at boot
- Your users will need to have the same uid/gid in each OS if you have a multiple boot system with a shared home.


Have fun!
 
Old 07-02-2005, 09:38 AM   #5
une
Member
 
Registered: May 2004
Location: Australia
Distribution: Mandrake 10, Puppy Linux 2.13
Posts: 201

Original Poster
Rep: Reputation: 30
Thanks all, I will continue my Linux odyssey.
 
Old 07-04-2005, 08:06 PM   #6
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
Quote:
For example can I burn /home to a DVD, then on a new distro on another hard disc just copy the DVD contents to / and voila
Yes and I can tell you from experience that this works quite well.

If you find you have weird problems with some applications on your new distro you may need to delete the settings that you carried over from your old distro for that app. So eg. if I had trouble with amarok I would go into .kde/share/config and .kde/share/apps and delete any files or folders to do with amarok. However this almost never needs to be done and then only if you have a problem with an application that you can't solve.

Also remember to set ownership properly on the files and directories in your home as your username on the new Linux distro may have a different userid. So for me I would do:
Code:
su
chown -R tim:tim /home/tim
after I copied the files from the DVD. You could also do this from the GUI if you start up konqueror as root (or login as root) and open the properties of your home folder. On the permissions tab change the ownership and check the 'Apply changes to all subfolders..' and click OK.
 
Old 07-10-2005, 06:59 AM   #7
une
Member
 
Registered: May 2004
Location: Australia
Distribution: Mandrake 10, Puppy Linux 2.13
Posts: 201

Original Poster
Rep: Reputation: 30
The comments by Bebo about hidden files have me a little concerned. Why does copying /home to DVD not transfer the hidden files as well? Are they not a part of /home?
What is a "recursive" copy?
How does one make a "recursive" copy?
What is a tar-ball?
These are probably basic questions but I''m just starting out in Linux.
 
Old 07-10-2005, 07:34 AM   #8
Bebo
Member
 
Registered: Jul 2003
Location: Göteborg
Distribution: Arch Linux (current)
Posts: 553

Rep: Reputation: 31
The recursive copying is probably a non-issue, so sorry for confusing you. I guess you'll be using some nice CD/DVD-burning application like k3b, and in that case everything inside the directory/ies that you select for burning will of course be burned, such as the hidden files.

In *nix systems, every file starting with a period (".") will be "hidden", i.e. not show up in a directory listing, unless you explicitly say that you want to see them. For instance ls will not show them, but ls -a will.

If you use a burning application like k3b, there is the simple way to burn the directory. Just do as you usually do, dragging the stuff to the correct place in k3b and hit "Burn". However, since /home tends to get large, you probably find yourself forced to compress the whole lot so that it fits. And there the tar-ball comes in handy. tar stands for "tape archive" and is a program to make packages of files and directories, just like WinZip in Windows. tar doesn't compress the packages by default, so you'll have to tell it to do that. For instance tar cf home.tar /home will bundle together everything in /home into the file (the "tar-ball") home.tar. You can compress this file using gzip, bzip2 or zip if you want to. If you instead do tar czf home.tar.gz /home then the home.tar file will be compressed with gzip on the fly. If you instead do tar cjf home.tar.bz2 /home you will use bzip2 for compressing the file.

After compression the archive named home.tar.gz or home.tar.bz2 will be approximately half as big as home.tar and may fit on your CD or DVD.

I mentioned that you should take care to include the dot-files just because you wouldn't want to miss them if you plan on doing what you do. I always double-check what I include in a tar-ball, just to make sure
 
Old 07-10-2005, 07:38 AM   #9
une
Member
 
Registered: May 2004
Location: Australia
Distribution: Mandrake 10, Puppy Linux 2.13
Posts: 201

Original Poster
Rep: Reputation: 30
Thanks a lot. I will continue my Linux odyssey.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
win xp home edition and samba home shares scheidel21 Linux - Software 8 10-09-2008 12:47 AM
Apache Root/Home Directory and setting up FTP for home directories? Mankind75 Linux - Newbie 6 07-23-2006 02:37 PM
want to ssh/ftp to home machine (Slack) from office through home router fincher69 Linux - Networking 2 09-21-2005 10:55 PM
Backing Up Home Dirs before upgrade Thin Mandriva 6 02-01-2005 11:44 PM
Backing up osx Linux - General 5 03-24-2003 02:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva

All times are GMT -5. The time now is 08:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration