LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Moving /home to a new HD poss hdb1 (https://www.linuxquestions.org/questions/debian-26/moving-home-to-a-new-hd-poss-hdb1-118919/)

londonboi 11-22-2003 01:46 PM

Moving /home to a new HD poss hdb1
 
Hi, I am going to be buying a 100GB HD soon as my current one is starting to run out of space! Now what i would like to do is home the whole /home directory to hdb1.

I want to do this without effecting any of my settings and want to to happen as smooth as possible! Can anyone lend any insights as to how i may do this and having hdb1 to mount automatically..... im not too good with fstab file at the moment so any help would be much apreciated :newbie:

fsbooks 11-22-2003 02:13 PM

This differs slightly depending on if your /home is now a separate partition, or included in /. Posting your fstab will get a better answer if this does not work, but basically you make your new partition in a temporary location (/mnt perhaps), copy the current /home to the new one (either use for example "cp -a /home /mnt/home", or something like "rsync -acvSx /home/ /mnt/home" or a variety of other commands -- someone probably has a good link for options), either modify your old fstab entry or add it in (if new) to read "/dev/hdb1 /home ext3 defaults 1 2" (assuming of course you use the ext3 filesystem). If you have a current /home partition, umount it and mount up the old and test it out. If /home is part of /, just mount it on top first for testing. Later assuming all goes right, you can umount the new /home and get rid of the of files.

I think that is it.

londonboi 11-22-2003 02:15 PM

Hey Thanks for your responce. I will try this in a few days once the HD arrivies. Just to note tho then /home is located on the same partition as / so both are on hda1

I will let you know what happens :)

Cheers

fsbooks 11-22-2003 02:46 PM

Sounds good. Just check and double check everything you are doing three times. Make and write down a plan. Proofread your command line carefully before hitting return. Moving a directory tree to a new location is simple, but can be disaster with a small mistake. The important thing is to maintain all ownership and permissions, maintaining proper links, and generally not crossing filesystem boundaries. If you use rsync, you may consider adding the -H option to preserve hard links if you have them. Don't forget to read the man pages and do not take any command for granted.

The simplist way of course to accomplish your task is:

mv /home/* /mnt/home
umount /home
umount /mnt/home
(modify fstab)
mount /home

However, I don't recommend this because if something does go wrong, you may be out of luck. If you have a way to backup /home to another location before any of this, that of course would not hurt at all :-)

Oh, and sorry for the disruption our imperial non-elected president has brought to your fair town.


All times are GMT -5. The time now is 01:15 AM.