LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-13-2008, 11:07 AM   #1
geoff3
LQ Newbie
 
Registered: Sep 2006
Location: south of France, Perpignan
Distribution: Mandriva 2010
Posts: 29

Rep: Reputation: 15
Howto move /home to 2nd disk


Hi,
I've just added a 2nd larger disk and would like to transfer /home to it.
I've tried this:
mkdir /mnt/newhome
mount -t ext3 /dev/sdb1 /mnt/newhome
cd /home
cp -ax * /mnt/newhome
unmount /mnt/newhome
up to now everthing is perfect.
mv /home /old_home
gives me:
mv: cannot move `/home' to `/old_home': Device or resource busy
I've tried doing:
init 3 and then repeating the move cmd but I get the same result, what am I doing wrong?
Geoff
 
Old 04-13-2008, 12:00 PM   #2
Slokunshialgo
Member
 
Registered: Jan 2006
Distribution: Ubuntu 9.04, Fedora 10
Posts: 76

Rep: Reputation: 17
Not 100% sure, but a couple things that could be causing it are that you could still be in the home directory (check your present working directory to make sure you're in /, not /home/...), or there could be a user logged in who's home is in /home (anybody but root). Try going down to runlevel 1, as runlevel 3 is normally the same as 5 but without a GUI, which could be causing interference. 1 is single-user, meaning only root can do anything.

As a final note, don't forget to edit your /etc/fstab file to auto-mount sdb1 as your /home. This line should work:
Code:
/dev/sdb1        /home            ext3        defaults         1   2
 
Old 04-13-2008, 12:04 PM   #3
geoff3
LQ Newbie
 
Registered: Sep 2006
Location: south of France, Perpignan
Distribution: Mandriva 2010
Posts: 29

Original Poster
Rep: Reputation: 15
This might help.
This is my situation at the moment:
[root@localhost geoff]# df
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 15G 8,1G 5,8G 59% /
/dev/sda7 49G 16G 34G 32% /home
/dev/sdb1 199G 16G 176G 9% /mnt/newhome
 
Old 04-13-2008, 12:16 PM   #4
geoff3
LQ Newbie
 
Registered: Sep 2006
Location: south of France, Perpignan
Distribution: Mandriva 2010
Posts: 29

Original Poster
Rep: Reputation: 15
Same thing (I am an single user)

[root@localhost usr]# cd /
[root@localhost /]# dir
bin initrd opt trash.desktop
boot lib proc upgrade.desktop
dead.letter libjavaplugin_oji.so register.desktop usr
dev lost+found root var
etc media sbin Welcome.desktop
home media.desktop sys
Home.desktop mnt tmp
[root@localhost /]# mv /home /old_home
mv: cannot move `/home' to `/old_home': Device or resource busy

Do I have to create old_home with mkdir before hand?
 
Old 04-13-2008, 12:47 PM   #5
Tischbein
Member
 
Registered: Oct 2006
Distribution: debian
Posts: 124

Rep: Reputation: 15
If you boot from knoppix you can be pretty certain that home isn't being used or, worse, is changing under you. But I think that is not the problem. /home is likely to be a partition. Look in /etc/fstab to confirm or run "mount". If so, edit /etc/fstab so that /home points at the new partition instead. Maybe also make a directory /mnt/old_home and add a line to /etc/fstab to automatically mount that. Reboot for the new settings to take effect.

You could unmount /home whilst running on the system, but that might go horribly wrong. If you are logged in as root and no-one else is logged in you might be OK, otherwise I think this is just asking for trouble big time. Maybe not . Root's home is not (usually) in /home.

Before starting - Make a backup of /etc/fstab and have a working knoppix disk to hand in case you find yourself locked out!

Have fun, Entenbein.

p.s. try to keep a log of everything you do - copy it to a file (and keep saving the file) or write it down so that we can help you if anything goes wrong.

Last edited by Tischbein; 04-13-2008 at 12:50 PM.
 
Old 04-13-2008, 01:08 PM   #6
geoff3
LQ Newbie
 
Registered: Sep 2006
Location: south of France, Perpignan
Distribution: Mandriva 2010
Posts: 29

Original Poster
Rep: Reputation: 15
This is what I have in fstab:

/dev/sda1 / ext3 relatime 1 1
/dev/sda7 /home ext3 relatime 1 2
/dev/cdrom /media/cdrom auto umask=0022,users,iocharset=utf8,noauto,ro,exec 0 0
none /proc proc defaults 0 0
/dev/sda5 swap swap defaults 0 0
/dev/sda6 swap swap defaults 0 0

"edit /etc/fstab so that /home points at the new partition instead"
not sure how to do that, I can't call the new partition /home yet until I get rid of the old one.

I've checked on the new disk by mounting it as /newhome that my data is there.
 
Old 04-13-2008, 01:44 PM   #7
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
Logged in as root (not just su).

umount /home

Edit fstab so the /home points to the new drive.

mount -a

Try logging into user and make sure that the shuffle worked. If it did you can delete the /home partition on the old drive and expand one of the other partition to regain the space.
 
Old 04-13-2008, 03:02 PM   #8
geoff3
LQ Newbie
 
Registered: Sep 2006
Location: south of France, Perpignan
Distribution: Mandriva 2010
Posts: 29

Original Poster
Rep: Reputation: 15
Smile

Magic, ca marche!! (that means it works)

thanks to all, Slokunshialgo, Tschbein, and lazlow

Geoff
 
Old 04-16-2008, 03:03 PM   #9
geoff3
LQ Newbie
 
Registered: Sep 2006
Location: south of France, Perpignan
Distribution: Mandriva 2010
Posts: 29

Original Poster
Rep: Reputation: 15
Hi, I'm back with more pbs
To recover the space used by /home I deleted the old partition on sda.
I expected to be able to extend the / partion with gparted but no, for some reason when I booted the CD it could not find my screen (pbs with xorg?).
So, seeing as I had backed-up everything I re-installed Mandriva 2008 from my DVD. This obviously gives me back a /home on sda which I don't want.
Question:
how do I install Linux on sda without /home so that it will use the /home on sdb.
Geoff
 
Old 04-16-2008, 03:55 PM   #10
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
During installation you should be prompted for the location to install the OS. I haven't used Mandriva, but other distros I have used offered the opportunity to select where to install /, /home, or any other directory to it's own partition.

So, during installation, elect to install / to sda and /home to sdb.

Last edited by bigrigdriver; 04-16-2008 at 03:57 PM.
 
Old 04-17-2008, 01:05 AM   #11
geoff3
LQ Newbie
 
Registered: Sep 2006
Location: south of France, Perpignan
Distribution: Mandriva 2010
Posts: 29

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bigrigdriver View Post
So, during installation, elect to install / to sda and /home to sdb.
Will this not wipe-out my data in /home on sdb?
 
Old 04-17-2008, 09:44 AM   #12
geoff3
LQ Newbie
 
Registered: Sep 2006
Location: south of France, Perpignan
Distribution: Mandriva 2010
Posts: 29

Original Poster
Rep: Reputation: 15
In response to my own question, if you don't ask for the partition (/home) to be formatted you don't loose your data.
Easy when you know
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to view/mount separate disk -- move /home to second disk Spearhead40 Ubuntu 12 11-03-2007 03:37 PM
Howto Move A File From My Pendrive To My Hd? PETROSHP Linux - Newbie 9 04-16-2007 10:39 PM
Howto move entire directories ? coolcargo Linux - Newbie 18 03-03-2007 11:30 PM
Put a 2nd kanotix at hdb 3/,-4/home. 1st is at hdb8/,-9/home.#2 is using 1st's /home sleekmason Linux - General 3 12-09-2006 09:21 AM
Can I move /home ? MikeyDIUP Linux - Newbie 3 09-11-2005 01:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:25 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