LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 07-24-2006, 11:20 AM   #1
FrodoTeeBagins
LQ Newbie
 
Registered: Jul 2006
Posts: 6

Rep: Reputation: 0
Moving Home Directory


I am running Novell Suse Desktop Enterprise. I have two hard drives in my system. Linux is installed on the first hard drive and the second hard drive is setup for extra storage. I would like to move my home directory to the second hard drive in case something should go wrong with the hard drive that linux is sitting on I will still have the files in my home directory sitting on the second hard drive. Im sort of new at this. any help would be appreciated.
 
Old 07-24-2006, 11:35 AM   #2
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Welcome to LQ!

This is actually pretty straight-forward. You want to mount the new drive to a temporary location (say like /mnt/temp_home). Once you've got it mounted, copy over everything from your current /home directory to the temporary one. Once that is completed, you'll probably need to edit your /etc/fstab file so that the new drive gets mounted to /home. I have a similar set-up (/home is on a separate hard driver from the rest of linux) and my fstab entry looks like this:

/dev/hdd1 /home reiserfs defaults 1 2

Of course you'll need to modify that to match your file system and device name.

If you re-boot and everything looks good, you can then mount your old /home to a new mountpoint (like /mnt/temp_home) and delete the files. You could also then re-distribute the space to Linux.
 
Old 07-24-2006, 11:41 AM   #3
kevkim55
Member
 
Registered: Dec 2005
Location: Edmonton
Distribution: BLFS, Gentoo
Posts: 353

Rep: Reputation: 32
Create a linux partition on the second HD and copy files from your existing home directory to it. Now mount the partition on your second hard disk on the /home directory.

# mount /dev/hdb1 /home

(Replace hdb2 with the partition name on 2nd HD)

To ensure this happens automatically every time you boot, include an appropriate line in your /etc/fstab file.

Quote:
/dev/hdb1 /home reiserfs defaults 1 2
Ofcourse, replace hdb1 with the partition name on 2nd HD and replace reiserfs with the type of file system you formatted this partition with.

If none of this makes much sense, come back and say so.

EDIT: Oops ! Lookz like Hangdog42 beat me to it. Ignore this !

Last edited by kevkim55; 07-24-2006 at 11:43 AM.
 
Old 07-24-2006, 12:58 PM   #4
FrodoTeeBagins
LQ Newbie
 
Registered: Jul 2006
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks guys I will look into it and report back. THIS PLACE ROCKS!
 
Old 07-24-2006, 02:42 PM   #5
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Quote:
Originally Posted by FrodoTeeBagins
I would like to move my home directory to the second hard drive in case something should go wrong with the hard drive that linux is sitting on I will still have the files in my home directory sitting on the second hard drive.
Hopefully nothing will then go wrong with the second hard drive that your /home is sitting on!

Sounds like you're worried about your data, and this is good. Now is the time to implement a backup plan ... before you need it. If you end up moving your /home to the second drive, back it up regularly to the first hard drive. If you have access to another computer on your network, backing up to a totally seperate computer is even better than to another hard drive on the same computer. Or you could backup to CDs/DVDs instead (or in addition to).
 
Old 07-24-2006, 02:59 PM   #6
FrodoTeeBagins
LQ Newbie
 
Registered: Jul 2006
Posts: 6

Original Poster
Rep: Reputation: 0
Well, I tried some of your suggestions and well IT WORKED !! I had originally set up sdb1 mounted in the following way:

/dev/sdb1 /data reiserfs acl,user_xattr 1 2

so here is what I did:

1. created a temporary directory labeled temp-home and moved all items in my home folder to the temp-home folder.

2. opened up a terminal windows and switched user to root. then typed

# mount /dev/sdb1 /home

;3. opened fstab as root and changed

/dev/sdb1 /data reiserfs acl,user_xattr 1 2
changed to:
/dev/sdb1 /home reiserfs acl,user_xattr 1 2
and deleted the previous /home entry.

4. at this point I messed up and rebooted without moving the files from temp-home to the new home directory. No worries, boot into failsafe and move them over through there.

AND, yes I do worry about my data I always like to keep it on a different drive. and I do backup alot. I used to practice this in a windows enviroment and since Im working on switching over I figured this practice would keep me safe until I become more literate with linux.

Thanks for all the help, this community rules!
 
Old 07-24-2006, 03:10 PM   #7
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Congrats! Probably the best reason to keep /home on its own partition is that if you need to re-install Linux (or simply want to try a different flavor) you don't have to worry about losing your /home directory. Once you get the system back up and running, all your files (and customizations) will be there.
 
Old 07-24-2006, 03:10 PM   #8
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
I don't understand what benefit you feel you've gained by putting your data on a different drive from the OS. I can understand putting /home in a different partition in case you need to reinstall the OS, but putting it on a different drive more or less doubles your chances of needing to perform annoying recovery to get the system back up.

Now, if you developed this habit with Windows I can sort of understand. Older versions of Windows would only install onto the whole drive, so even data in a different partition would have to be wiped to do a clean reinstall.
 
Old 07-24-2006, 03:16 PM   #9
FrodoTeeBagins
LQ Newbie
 
Registered: Jul 2006
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by IsaacKuo
I don't understand what benefit you feel you've gained by putting your data on a different drive from the OS. I can understand putting /home in a different partition in case you need to reinstall the OS, but putting it on a different drive more or less doubles your chances of needing to perform annoying recovery to get the system back up.

Now, if you developed this habit with Windows I can sort of understand. Older versions of Windows would only install onto the whole drive, so even data in a different partition would have to be wiped to do a clean reinstall.

The reason listed above by HangDog pretty much says it all, the fact that it is a different drive and not a partition is basically a luxury of having another drive. Also, if a drive fails and the drive is partitioned you loose everything. If a drive fails and you have your data on another, all you loose is your OS installation

Last edited by FrodoTeeBagins; 07-24-2006 at 03:18 PM.
 
Old 07-24-2006, 03:34 PM   #10
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
You get all the benefits by putting it in a separate partition ON THE SAME DRIVE as the OS.

Any hard drive can fail. This includes the second drive that you have /home in. If that drive fails, then you lose your data.

Here are two possibilities if you put the data partition in the same drive as the OS:

1. Hard drive 1 fails--you need to replace the drive and recover from backup.

2. Hard drive 2 fails--no problem. You can simply remove that drive and comment out the fstab entry.

Here are two possibilities if you put the data in the other drive from the OS:

1. Hard drive 1 fails--you need to replace the drive and recover from backup.

2. Hard drive 2 fails--you need to replace the drive and recover from backup.

See the problem? You've roughly doubled your chances of needing to perform an annoying recovery.

You seem to be ignoring the possibility that your second drive could be the one which fails.
 
Old 07-24-2006, 04:42 PM   #11
FrodoTeeBagins
LQ Newbie
 
Registered: Jul 2006
Posts: 6

Original Poster
Rep: Reputation: 0
Wink

My view is this:

What seems more likely 1 hard drive failing. or both hard drive failing.

I think I will go with the odds that both hard drives failing is not likely.

Situation 1: Two Hard Drives

HD 1 (OS) Craps Out: Reinstall Linux and change the fstab to point to my home directory. Poof all is well, Sux yes but all is well

HD 2 (data) Craps Out:
Install new drive and revert to last backup. Poof all is well

HD 1 & 2 (OS & Data) Crap Out, Very unlikely:
Im F*****, unless I backed up both.

Situation 2: One Hard Drive 2 Partitions

HD 1 (Part.1 = OS, Part.2 = Data) Craps Out
Im F*****, unless I backed up both



ILL Take my chances With SITUATION 1
 
Old 07-24-2006, 07:42 PM   #12
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
IBM put together a very nice article on moving your home partition Good luck with it and Welcome to LQ!
 
Old 07-24-2006, 08:31 PM   #13
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Quote:
Originally Posted by FrodoTeeBagins
HD 1 (Part.1 = OS, Part.2 = Data) Craps Out
Im F*****, unless I backed up both
Why?

You apparently have backed up the data, right? And you apparently would rather reinstall the whole OS than bother keeping a backup of the OS.

So, if your OS and data both "crap out", then you just:

1. Replace the drive.

2. Install the OS.

3. Restore from the last backup.

Yippee! No problem! Instead of two steps, you have to do three steps. Big deal! If you're already dealing with an annoying recovery, what's one extra step? You've roughly halved your chances of needing to do the annoying recovery in the first place.

Alternatively, you could put an OS partition on both of the drives, and put data partitions on both of the drives. Then you use rsync and/or RAID1 arrays to make the second drive backup the first. In that case:

1. The first drive fails--then you remove it and switch channels on the first drive. Yippee!

2. The second drive fails--then you remove the second drive. Yippee!

3. Both drives fail--then you buy a new drive, install the OS, and restore your data from backup. Annoying, but not very likely.

I fail to see any reason why your method is preferable. It merely increases the chances that you'll need to perform an annoying repair.
 
Old 07-25-2006, 08:13 AM   #14
FrodoTeeBagins
LQ Newbie
 
Registered: Jul 2006
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by IsaacKuo
Yippee! No problem! Instead of two steps, you have to do three steps. Big deal! If you're already dealing with an annoying recovery, what's one extra step?
Well perhapse in your world one extra step is no big deal. But im my job one extra step is one to many. Have fun with your one extra step.

Quote:
Originally Posted by IsaacKuo
I fail to see any reason why your method is preferable. It merely increases the chances that you'll need to perform an annoying repair.
my method is preferable because its the way I want to do it. we should run a poll to see how many others want to add another step. Thanks to all for the help it is greatly appreciated.

Last edited by FrodoTeeBagins; 07-25-2006 at 08:14 AM.
 
Old 07-25-2006, 08:53 AM   #15
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
If one extra step is too much, then you should really rsync and/or RAID1 to mirror the OS and data on the two drives. Then there's only one step, and if the drives are hot-pluggable there's potentially not even any downtime.

You do understand that by making either drive a point of failure, you're roughly doubling the chances of a failure, right?
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
moving out home directory during ftp session saeed_zarea Linux - Networking 8 07-12-2011 07:07 AM
Apache Root/Home Directory and setting up FTP for home directories? Mankind75 Linux - Newbie 6 07-23-2006 02:37 PM
How to protect a file/directory in your home login directory (RH Linux) jitsenho Linux - Security 9 07-03-2006 11:08 PM
Moving /home Directory? NovaBurst DamnSmallLinux 1 04-18-2005 10:59 PM
Moving my /home directory to another hd bumpert Linux - Newbie 6 07-26-2004 03:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:43 PM.

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