LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 05-01-2007, 11:05 PM   #1
frazelle09
Member
 
Registered: Dec 2004
Location: Mexicali, Baja California, México
Distribution: PCLinuxOS 2016 - 64bit on four machines, including a laptop.
Posts: 117

Rep: Reputation: 17
How to move /home to new partition


i had a Freespire Alpha 2 installed on one partition. i wanted to make another partition to hold the user or data info. so that if i have to install the OS again i don't have to do so much work setting up everything else.

What i have done so far is to use GParted to resize the original partition to about 10 Gb for the OS and made a second partition (also reiserfs) for the data and which is about 30 Gb. My system now reports the second partition as dev/mnt/sda2 and i mounted it and can see it under Konquerer as /mnt/SecondPartitionHere (i didn't know what else to call it.)

This is pretty frightening because i don't know what is really happening or will happen but i understand that now, all i need to do is to copy my /home/me directory to /mnt/SecondPartitionHere (maybe i should name it something else before i do this???) and delete the /home/me from the first partition. My first question is, is this correct?

My next question is, what will my monitor show the next time i boot up? Will i still have the screen background, task bar at the bottom, access to Control Panel and Launch, and the programs, etc.? or What's gonna happen?

Can i do this with just Konqueror as "copy/paste"?

And lastly, do i need to "move" anything else from the first partition -- something from root for example? This sounds way too simple, but i am pretty new to Linux so i would like to get it right the first time.

Have a great evening!

Last edited by frazelle09; 05-01-2007 at 11:08 PM.
 
Old 05-02-2007, 12:11 AM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
To pretty much address what you're trying to do, here's what I did:
First, I backed up my /home folder to somewhere safe, *just incase*...
Then:
Using MC or Konqueror as root, I copied everything INSIDE /home to the new drive or partition. Just a plain old 'highlight the contents of /home and copy&paste it all' so that all the USER accounts are now sitting in the new partition's root directory (make sure you get the hidden files too).
Next, I unmounted the new partition, and edited my /etc/fstab file and made an entry which mounts the new partition containing the user accounts, onto /home during boot. (You may already have a temporary entry like this where you have mounted the new partition on /mnt/secondpartitionhere, so you can just rename it.)
Last step: delete everything from inside the original /home folder. (Leave the /home folder itself, just remove everything in it. You likely will need to log out and go to single user mode for this, because some stuff in /home may be in use as you are logged in and working. Of course, if you are logged in as root and doing all this, there should be no problem here.)

Now, either reboot or simply mount the new partition as per the fstab file (with a command like mount /home or mount /dev/sda2) and presto. All done.
From all appearances, nothing will look or act any differently than it did before.
You don't need to copy any/other/root files or folders at all. And after the reboot or remount, the machine will boot and start your desktop just like it always did -- same taskbar, same wallpaper, etc...
Once it all is verified to be done correctly and there are no problems, you can discard the backup you made of the original /home folder.

Even if you happen to screw up something temporarily along the way, it isn't a critical issue, especially if you have made a backup of the /home account(s) before starting. Just log in as root to fix the problem. Such as wrong mount options, or wrong foldername somewhere..
 
Old 05-02-2007, 12:13 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Yes, you got the right idea. Create a directory such as /home-new and mount the new partition there. After copying the contents of /home -> /home-new, unmount /home, edit /etc/fstab so that the new partition is mounted under /home. Finally remove the /home-new directory and mount /home.
use the "--archive" option to cp. This is an example where it is best to do this as root. Root has it's own home directory (/root) so if you aren't logged in as a user, then there isn't a problem unmounting the /home directory.

Look in the info manual for the tar command. There is an example using tar to move a directory.

Last edited by jschiwal; 05-02-2007 at 12:14 AM.
 
Old 05-02-2007, 12:15 AM   #4
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Hey that 'archive' option is a good idea jschiwal though I didn't use it - simply not that much stuff at 'home' here
 
Old 05-02-2007, 12:25 AM   #5
frazelle09
Member
 
Registered: Dec 2004
Location: Mexicali, Baja California, México
Distribution: PCLinuxOS 2016 - 64bit on four machines, including a laptop.
Posts: 117

Original Poster
Rep: Reputation: 17
Wow! You guys (and gals?) are great! It still looks a little complicated, but i'm gonna reread it several times to see if i can get it right the first time -- that'd be a first.

i'm glad i don't have to move anything belonging to /root. That's a plus. Any Krusader has a root mode.

Well, here goes nuttin'.

Thanks again for such abundant and rapid help... i've been sitting here in front of this monitor, just waiting for someone to respond

Have a great evening!
 
Old 05-02-2007, 01:14 AM   #6
frazelle09
Member
 
Registered: Dec 2004
Location: Mexicali, Baja California, México
Distribution: PCLinuxOS 2016 - 64bit on four machines, including a laptop.
Posts: 117

Original Poster
Rep: Reputation: 17
Well, before we go any further here is an update.

i did the copy paste routine but when i go to terminal and try this...

frazelle09@LaGrandota:~$ sudo umount /dev/sda2 /mnt/2ndPartition (i renamed it before copying)

i get this...

umount: /dev/sda2: not mounted
umount: /mnt/2ndPartition: not mounted

i can still "see" /mnt/2ndPartition now with /frazelle09 and all of its folders. When i check the size of each frazelle09, the /home/frazelle09 gives me some 129 Gb ??? which is clearly impossible since my hd is only 40GB. The /mnt/2ndPartion/frazelle09 gives me some 2.5 Gb or so.

Have i blown it yet? i do fdisk -l and get...

Disk /dev/sda: 41.1 GB, 41110142976 bytes
255 heads, 63 sectors/track, 4998 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 1369 10996461 83 Linux
/dev/sda2 1370 4998 29149942+ 83 Linux

So what do i need to do to unmount this thing so i can proceed to the next step of editing my fstab?

Have a great evening!
 
Old 05-02-2007, 01:48 AM   #7
DaveQB
Member
 
Registered: Oct 2003
Location: Sydney, Australia.
Distribution: Debian, Ubuntu
Posts: 400

Rep: Reputation: 39
A few notes from the above hints that I do.

firstly, you can still have a folder full of files and folders in it and it can still be used as a mount point. This is good as it means you dont need to copy or backup and delete your former /home on the root partition before testing your settings. It just means you cant access the files "underneath" the mount and so you essentially lose that space. No worries, you can always umount, delete files there and remount your new home.

As for copying, I would suggest cp -a, easier to type then archive

Now for your current situation.

Whats "frazelle09" ?

I am confused with what you have done.

Its a simple process.

I'd suggest booting into single user mode and:

Code:
mkdir /mnt/temp
mount /dev/sda2 /mnt/temp
cp -a /home/* /mnt/temp/
Edit /etc/fstab
Ask if your not sure.

Reboot and your done.

PS if all goes well, go back some later date and delete files in home on /dev/sda1
 
Old 05-02-2007, 02:12 AM   #8
frazelle09
Member
 
Registered: Dec 2004
Location: Mexicali, Baja California, México
Distribution: PCLinuxOS 2016 - 64bit on four machines, including a laptop.
Posts: 117

Original Poster
Rep: Reputation: 17
Dave, Thanks for replying! Uh, to answer your questions...

1. frazelle09 is what i think is my "user" directory which resides under /home, as in /home/frazelle09. It contains all my data files (OpenOffice stuff mainly.)

2. i am currently doing what you suggested, but since i can't figure out how to "boot into..." i'm running a term as sudo and watching my hd light go zzzzzzzzz.

i hope this works... and i thank you again for the post.

BTY, i need to ask how to edit my fstab. Here is what it currently looks like:

rootfs / reiserfs comment=jiffymount,noatime,nodiratime,rw 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
none /proc/bus/usb usbfs defaults 0 0
none /dev/pts devpts rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
/boot/linux-swap.swp none swap sw 0 0


Have a great evening! (i'm starting to get nervous, my hd light is still on -- i wouldn't think that it would take so long to just copy a couple of gb from one partition to another...)

Update... the hd light finally went out and i closed the Konsole. In Krusader i checked the /temp/frazelle09 directory and it has some 5 Gb of files, so i guess it's o.k. It also shows that i have 22.4 Gb out of the 27 Gb, so this time it looks like the cp worked. i also deleted the old /frazelle09 on the /mnt/2ndPartition to clean things up.

Last edited by frazelle09; 05-02-2007 at 02:20 AM.
 
Old 05-02-2007, 09:03 AM   #9
frazelle09
Member
 
Registered: Dec 2004
Location: Mexicali, Baja California, México
Distribution: PCLinuxOS 2016 - 64bit on four machines, including a laptop.
Posts: 117

Original Poster
Rep: Reputation: 17
Does this look like the correct line in fstab in order for the OS to mount the new partition?

/dev/sda2 /mnt/tmp/frazelle09 reiserfs defaults 0 0

Should this line be placed in any particular place in fstab?

Can i rename the partition to just frazelle09 instead of /tmp before i edit fstab?

Have a great morning!
 
Old 05-02-2007, 11:24 AM   #10
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
I'm not quite clear what you did exactly. Why is the directory called /mnt/tmp/frazelle09? Did you copy all of home or only the frazelle09 subdirectory? I hope it's all of home or you could be in trouble.
 
Old 05-02-2007, 11:42 AM   #11
frazelle09
Member
 
Registered: Dec 2004
Location: Mexicali, Baja California, México
Distribution: PCLinuxOS 2016 - 64bit on four machines, including a laptop.
Posts: 117

Original Poster
Rep: Reputation: 17
Oh, Jay, you be scaring me already, man.

i just copied frazelle09. When i last checked, all my /home dir. had in it was frazelle09. i don't know if this has anything to do with it, but i'm running Freespire, which is Ubuntu-based, so????

As to the why i did this, i got some advice from DaveQB...

"mkdir /mnt/temp
mount /dev/sda2 /mnt/temp
cp -a /home/* /mnt/temp/"

Maybe this additional info will help. This is the output from a df - h command...

frazelle09@LaGrandota:~$ df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 11G 7.7G 2.9G 74% /
varrun 506M 220K 506M 1% /var/run
varlock 506M 0 506M 0% /var/lock
udev 506M 76K 506M 1% /dev
devshm 506M 0 506M 0% /dev/shm
tmpfs 506M 0 506M 0% /dev/shm
df: `/home/frazelle09/Network/JALALFRAZELLE/200Gig (J)': Input/output error
df: `/home/frazelle09/Network/JALALFRAZELLE/Freds': Input/output error
/dev/sda2 28G 6.1G 22G 22% /mnt/temp

Thanks for replying! and have a great morning!

Last edited by frazelle09; 05-02-2007 at 02:15 PM.
 
Old 05-02-2007, 07:15 PM   #12
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
I bet you are still using your old home directory.

Go to runlevel 1:
su -
root password
init 1

sign in as root (if required)

move your old home directory:
mv /home /oldhome

unmount /dev/sda2:
umount /dev/sda2 (if the system tells you /dev/sda2 is not mounted, that's OK, skip this step).

create the new /home: mv /mnt/tmp /home

check whether the changes have taken effect:
cd /
ls
if you see both "home" and "oldhome", you're OK

remount /dev/sda2:
mount /dev/sda2 /home

check again:
cd /home
ls
if you see the subdirectories of /home, that's a good sign.

now edit /etc/fstab:
nano /etc/fstab
and put in this line:
/dev/sda2 /home reiserfs defaults 0 0
remove the line you put in before
save by pressing Ctrl+O, Enter, Ctrl + X

Ctrl + D

now do:
startx (or init 5)

If anything goes wrong, don't panic. Your old /home is still around (but it's called oldhome now). If you find everything is stable (best to wait for a couple of days), the /oldhome directory can be deleted.

Last edited by jay73; 05-02-2007 at 07:17 PM.
 
Old 05-02-2007, 09:22 PM   #13
frazelle09
Member
 
Registered: Dec 2004
Location: Mexicali, Baja California, México
Distribution: PCLinuxOS 2016 - 64bit on four machines, including a laptop.
Posts: 117

Original Poster
Rep: Reputation: 17
Finally got it to work!

This post also helped a great deal...

http://ubuntu.wordpress.com/2006/01/...own-partition/

Thanks to everyone who helped and

have a great evening!
 
  


Reply

Tags
data, files, moving, partition



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 do I move /home to a new partition? glenn69 Linux - Newbie 2 01-05-2005 10:15 PM
how can I move my /home to anohther partition ? linjia Linux - Software 1 12-11-2004 11:07 AM
How do i move /home to a new partition? glenn69 Linux - General 8 06-25-2004 11:38 AM
Partition Free Space - Move /home to the new partition gregkise Linux - General 5 12-16-2003 10:19 PM
Move /home to Windows Partition Campy19 Mandriva 2 11-23-2003 12:24 AM

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

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