UbuntuThis forum is for the discussion of Ubuntu Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: PCLinuxOS 2016 - 64bit on four machines, including a laptop.
Posts: 117
Rep:
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.
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..
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.
Distribution: PCLinuxOS 2016 - 64bit on four machines, including a laptop.
Posts: 117
Original Poster
Rep:
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
Distribution: PCLinuxOS 2016 - 64bit on four machines, including a laptop.
Posts: 117
Original Poster
Rep:
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?
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
Distribution: PCLinuxOS 2016 - 64bit on four machines, including a laptop.
Posts: 117
Original Poster
Rep:
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:
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.
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.
Distribution: PCLinuxOS 2016 - 64bit on four machines, including a laptop.
Posts: 117
Original Poster
Rep:
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...
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.