d833 Changing /home to another HDD - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Base System > Installing & Upgrading

Installing & Upgrading Installing and upgrading FreeBSD.

Reply
 
Thread Tools Display Modes
  #1  
Old February 19th, 2011, 04:44
caesius caesius is offline
Member
 
Join Date: Nov 2008
Location: New Zealand
Posts: 273
Thanks: 56
Thanked 16 Times in 15 Posts
Default Changing /home to another HDD

I have a single HDD at the moment. I want to keep this drive but add a new 320GB HDD and make that the new /home.

How should I go about this and are there any pitfalls to avoid? In my mind I will do this:

1. Connect new HDD and format with UFS.
2. Copy /home/* onto the new HDD.
3. Edit fstab and add the line:
Code:
/dev/ad2s1 /usr/home ufs rw 1 1
How does this sound? Do I have to specify any flags to cp to retain permissions etc? Also, on tangential note, could I use ZFS for this new /home partition?

Cheers.

Last edited by DutchDaemon; February 20th, 2011 at 02:41.
Reply With Quote
  #2  
Old February 19th, 2011, 05:39
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,725
Thanks: 432
Thanked 1,762 Times in 1,459 Posts
Default

Use at least -a with cp(1), but I would use net/rsync:
# rsync -aH /usr/home/ /mnt/

Might also want -A and -X or others.

If the new drive is faster than the old, you might be better moving the whole system over to it.
Reply With Quote
The Following User Says Thank You to wblock@ For This Useful Post:
caesius (February 19th, 2011)
  #3  
Old February 19th, 2011, 12:48
jem jem is offline
Member
 
Join Date: Oct 2009
Location: United Kingdom
Posts: 325
Thanks: 17
Thanked 51 Times in 41 Posts
Default

If your home directories are to reside in a seperate filesystem from /usr, then just mount it directly under /home, not under /usr/home.

You'll have to delete the /home symlink to /usr/home first then create an empty /home directory to use as the new mountpoint.
__________________
http://www.b0rken.org/

Last edited by DutchDaemon; February 20th, 2011 at 02:42. Reason: proper formatting: http://forums.freebsd.org/showthread.php?t=8816
Reply With Quote
  #4  
Old February 19th, 2011, 15:24
SirDice's Avatar
SirDice SirDice is offline
Moderator
 
Join Date: Nov 2008
Location: Rotterdam, Netherlands
Posts: 13,725
Thanks: 47
Thanked 2,023 Times in 1,862 Posts
Default

Quote:
Originally Posted by jem View Post
If your home directories are to reside in a seperate filesystem from /usr, then just mount it directly under /home, not under /usr/home.

You'll have to delete the /home symlink to /usr/home first then create an empty /home directory to use as the new mountpoint.
And if you just mount it under /usr/home/ you don't have to change anything at all

This is from the top of my head:
Code:
gpart create -s MBR ad2
gpart add -t freebsd-ufs -l myhome ad2
newfs /dev/gpt/myhome
mkdir /mnt/home
mount /dev/gpt/myhome /mnt/home
tar -C /usr -cf - home | tar -C /mnt -xvf -
umount /mnt/home
rm -rf /usr/home/*
mount /dev/gpt/myhome /usr/home/
You can also try GPT instead of MBR for the partitioning scheme, see gpart(8). The piped tar commands will make sure everything is copied correctly, including hard and softlinks. The label makes it easier to 'handle' the disk. Now it won't matter which drive number or driver (ad0, ad1, da0, da1, ada0, etc.) it gets.

And last but not least, edit /etc/fstab:
Code:
/dev/gpt/myhome /usr/home/ ufs  rw  2   5
Obviously you need this placed after the /usr/ entry. The 5 is to make sure the fsck is run after the others have finished, higher numbers are done last. Especially when you have multiple (big) filesystems it pays off not to run them all at the same time.
__________________
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
Reply With Quote
The Following User Says Thank You to SirDice For This Useful Post:
caesius (February 19th, 2011)
  #5  
Old February 19th, 2011, 15:53
gkontos's Avatar
gkontos gkontos is offline
Senior Member
 
Join Date: Dec 2009
Location: Polidendri, GR
Posts: 1,268
Thanks: 42
Thanked 218 Times in 164 Posts
Default

You don't need to use gpt for that unless you want to boot from it. Instead label the disk:
Code:
glabel label -v name /dev/ad2 (where ad2 is your new drive)
And your fstab would look like this:
Code:
/dev/label/name /usr/home/ ufs  rw  2   5
Assuming you mount your new drive under /tmp you can easily copy your data like this:
#(cd /home && tar cf - .) | (cd /mnt && tar xpf -)
__________________
Powered by BareBSD
Reply With Quote
The Following User Says Thank You to gkontos For This Useful Post:
caesius (February 20th, 2011)
Reply

Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing userid rbizzell33 General 14 April 12th, 2010 16:39
[Solved] Changing date without changing time. caesius General 6 February 8th, 2010 16:30
Changing architecture? Dinchamion Installing & Upgrading 5 July 2nd, 2009 21:32
Changing users home massively godzilla General 2 November 21st, 2008 11:01


All times are GMT +1. The time now is 00:24.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0