LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 02-04-2007, 08:03 AM   #1
the2k
Member
 
Registered: Dec 2005
Location: Devon - UK
Distribution: Suse - Desktop, Arch - Laptop, Centos - Server and whatever I fancy on the other machine ;)
Posts: 59

Rep: Reputation: 15
adding a new hard disk *solved*


Hi there,

i'm running out of room on my hard disk, so i have installed a new hard disk to be mounted as /home/mike which is my home folder...

what i want to know is the easiest way of firstly copying the entire contents of my current home folder to the new disk? then altering fstab so that the system boots up pointing /dev/hdc1 to /home/mike so that it appears to the system as though nothing has changed, i.e. x works, etc...

sorry if this is really easy, i'm just worried about permissions etc...

Last edited by the2k; 02-05-2007 at 09:09 AM.
 
Old 02-04-2007, 09:24 AM   #2
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
To make it easier and quicker post contents of /etc/fstab.
Post output of ' /sbin/fdisk -l '. Must be done as root.
What partition on the second drive are you wanting mike to be on.

With the above I could write a step by step for you.
I am guessing you only wish to move your home directory mike to the new drive. I would move the entire /home directory.

Brian

Last edited by Brian1; 02-04-2007 at 09:25 AM.
 
Old 02-04-2007, 09:56 AM   #3
the2k
Member
 
Registered: Dec 2005
Location: Devon - UK
Distribution: Suse - Desktop, Arch - Laptop, Centos - Server and whatever I fancy on the other machine ;)
Posts: 59

Original Poster
Rep: Reputation: 15
currently fstab looks like this....

Code:
none                   /dev/pts      devpts    defaults            0      0
none                   /dev/shm      tmpfs     defaults            0      0

/dev/cdrom             /mnt/cd   iso9660   ro,user,noauto,unhide   0      0
/dev/dvd               /mnt/dvd  udf       ro,user,noauto,unhide   0      0
/dev/fd0               /mnt/fl   vfat      user,noauto             0      0

/dev/hdb1 swap swap defaults 0 0
/dev/hdb2 / reiserfs defaults 0 0
/dev/hdb3 /home reiserfs defaults 0 0
/dev/hda1 /mnt/windows ntfs user,rw,umask=000 0 0

and /sbin/fdisk -l

Code:
Disk /dev/hda: 80.0 GB, 80060424192 bytes
255 heads, 63 sectors/track, 9733 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        9733    78180291    7  HPFS/NTFS

Disk /dev/hdb: 163.9 GB, 163928604672 bytes
255 heads, 63 sectors/track, 19929 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1               1         115      923706   82  Linux swap / Solaris
/dev/hdb2   *         116        2547    19535040   83  Linux
/dev/hdb3            2548       19929   139620915   83  Linux

Disk /dev/hdc: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdc1               1       38913   312568641   83  Linux
I have partioned the new drive as one big partition and it's already formatted using reiserfs
 
Old 02-04-2007, 10:51 AM   #4
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
Brian1 has asked you to post the right info, and perhaps gone to walk the dog. You probably want to get busy, so I hope it's not considered impolite to "jump in"...

What you need to do now (as root, logged in in a <CTL><ALT><F1> console, do NOT also be logged in to X as yourself, you only want one user, root, or your home partition will be active) is the following:

Make a new mountpoint for your new drive:
mkdir /mnt/newhome
Mount your new drive there
mount -t reiserfs /dev/hdc1 /mnt/newhome
Copy all your files over, complete with permissions etc.
cd /home
tar cf - . | (cd /mnt/newhome && tar xBfp -)

Don't worry if you get messages like "xxxxx: Pipe: Ignored"
#unmount your new disk
umount /dev/hdc1

Now edit your fstab so that the line
"/dev/hdb3 /home reiserfs defaults 0 0"
becomes
"/dev/hdc1 /home reiserfs defaults 0 0"

Reboot (is probably safest), or you could try Edit: cd / ; /Edit umount /dev/hdb3 ; mount -a
df -h should give you a nice-looking output
Now all you have to do is decide what to do with the (redundant) old home partition (/dev/hdb3), and tidy up (rmdir /mnt/newhome)

Hope it all goes smoothly, if you foul-up, you should be able to login as root at a CTL><ALT><F1> console and repair things.

Last edited by tredegar; 02-04-2007 at 11:01 AM.
 
Old 02-04-2007, 11:07 AM   #5
the2k
Member
 
Registered: Dec 2005
Location: Devon - UK
Distribution: Suse - Desktop, Arch - Laptop, Centos - Server and whatever I fancy on the other machine ;)
Posts: 59

Original Poster
Rep: Reputation: 15
cheers for that,

just going to have me tea, then i'll give it a go

Mike
 
Old 02-04-2007, 11:15 AM   #6
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
Looks good to do as tredegar says. Makes these answer easier with the users info instead of providing examples.

For the fstab you can add the last line for /dev/hdc1. Then just rename the one for /dev/hdb3 /home to /dev/hdb3 /home_backup. Before it could mount you need to make the /home_backup directory. ' mkdir /home_backup '

Brian
 
Old 02-04-2007, 01:46 PM   #7
starcutter
LQ Newbie
 
Registered: Jun 2006
Posts: 14

Rep: Reputation: 0
Great post! I was just about to ask the same question and you saved me the trouble. My Debian server is host to all our family's pictures/movies and our iPod library. It's too big for the current disk space to back up and a new disk is on the way...
 
Old 02-04-2007, 04:52 PM   #8
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
Glad to be of help there starcutter.

Brian
 
Old 02-05-2007, 09:09 AM   #9
the2k
Member
 
Registered: Dec 2005
Location: Devon - UK
Distribution: Suse - Desktop, Arch - Laptop, Centos - Server and whatever I fancy on the other machine ;)
Posts: 59

Original Poster
Rep: Reputation: 15
Cheers for that

It worked a treat, no problems or issues... took a while to copy all the files over though! but that was to be expected.

thanks again
Mike
 
Old 02-05-2007, 10:52 AM   #10
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
Good. Thanks for the follow-up.
 
  


Reply

Tags
home, partition


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
Adding new SCSI Hard disk Saravana Pandi Linux - Server 1 01-24-2007 04:26 PM
Adding another Hard disk Unicron Linux - Newbie 4 05-24-2006 01:05 PM
Adding and using another hard disk Greebstreebling Linux - Hardware 5 12-21-2005 02:19 PM
adding new hard disk jkmartha Linux - Newbie 3 08-19-2005 01:09 AM
Adding a hard disk mastahnke Linux - Hardware 15 11-27-2002 07:25 PM


All times are GMT -5. The time now is 05:54 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration