LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-06-2004, 01:25 AM   #1
davidas
Member
 
Registered: Mar 2004
Distribution: Debian 'Sarge'
Posts: 168

Rep: Reputation: 30
Low Harddisk space. Can I just transfer the entire Linux to a bigger harddisk?


Filesystem Size Used Avail Use% Mounted on
/dev/hda3 1.1G 948M 75M 93% /
tmpfs 251M 0 251M 0% /dev/shm
/dev/hda2 462M 51M 387M 12% /home

I'm going to install a bigger harddisk as slave, and then partitioned it :-
/dev/hdb1 /
/dev/hdb2 /home

mount /dev/hdb1 /mnt/hdb1
mount /dev/hdb2 /mnt/hdb2
(Are these the right commands to copy the entire content on the original harddisk to the new harddisk?)

cp -pR /*.* /mnt/hdb1
cp -pR /home/*.* /mnt/hdb2

Afterwhich, physically swap both harddisk, so that the bigger harddisk is now the master and the original harddisk the slave. Will the drive letter be automatically updated? ie. the new harddisk when plug in as master will automatically be hda and the original harddisk ,which is plug in as slave, be hdb?


Is this the correct method?

Thanks !

Last edited by davidas; 04-06-2004 at 02:45 AM.
 
Old 04-06-2004, 02:08 AM   #2
iluvatar
Member
 
Registered: Jul 2003
Location: netherlands
Distribution: debian
Posts: 403

Rep: Reputation: 30
never tried it, but anyway you have to install you're favorite bootloader on the new drive too...
 
Old 04-06-2004, 02:44 AM   #3
davidas
Member
 
Registered: Mar 2004
Distribution: Debian 'Sarge'
Posts: 168

Original Poster
Rep: Reputation: 30
mount /dev/hdb1 /mnt/hdb1
mount /dev/hdb2 /mnt/hdb2
(Are these the right commands to copy the entire content on the original harddisk to the new harddisk?)

cp -pR /*.* /mnt/hdb1
cp -pR /home/*.* /mnt/hdb2
/sbin/grub-install /dev/hdb1 <------ would this suffice?

Afterwhich, physically swap both harddisk, so that the bigger harddisk is now the master and the original harddisk the slave. Will the drive letter be automatically updated? ie. the new harddisk when plug in as master will automatically be hda and the original harddisk ,which is plug in as slave, be hdb?

Quote:
Originally posted by iluvatar
never tried it, but anyway you have to install you're favorite bootloader on the new drive too...
 
Old 04-06-2004, 02:49 AM   #4
spurious
Member
 
Registered: Apr 2003
Location: Vancouver, BC
Distribution: Slackware, Ubuntu
Posts: 558

Rep: Reputation: 31
Just to continue with Iluvatar's answer, do the following to install the bootloader on hdb:

chroot /mnt/hdb1
/sbin/lilo
exit

The 'chroot' command changes root to /mnt/hdb1, your "new root". When you run lilo, it will execute from the "new root" on /mnt/hdb1, and install your bootloader to the MBR on hdb1.

Hopefully, when you reboot with your new hard-disk, everything should work.
 
Old 04-06-2004, 02:50 AM   #5
iluvatar
Member
 
Registered: Jul 2003
Location: netherlands
Distribution: debian
Posts: 403

Rep: Reputation: 30
well, I don't know if it's going to work. it looks ok to me, and at least you always have your old harddisk as backup I would say: try it I don't know about grub, I'm used to lilo, got grub running now for 3 days or so...

good luck with this
-= iluvatar =-
 
Old 04-06-2004, 02:54 AM   #6
spurious
Member
 
Registered: Apr 2003
Location: Vancouver, BC
Distribution: Slackware, Ubuntu
Posts: 558

Rep: Reputation: 31
If you're using grub, then substitute 'lilo' with 'grub' in my post.
 
Old 04-06-2004, 03:43 AM   #7
davidas
Member
 
Registered: Mar 2004
Distribution: Debian 'Sarge'
Posts: 168

Original Poster
Rep: Reputation: 30
Thanks for all the help!

After doing a chroot /mnt/hdb1, and installing the grub into the MBR of hdb1, I'll take out the orginal harddisk (hda) and swap it with the new harddisk (hdb), so that the new harddisk is now the master drive. Will the new harddisk become hda automatically (instead of hdb previously) since it is now connected as master? If so, will the bootloader try to boot up from hdb1 (since it was chroot /mnt/hdb1 and grub-install) ?

PS. Could you elaborate on chroot please? Also, how do you get out of chroot? exit?

Thanks !


Quote:
Originally posted by spurious
Just to continue with Iluvatar's answer, do the following to install the bootloader on hdb:

chroot /mnt/hdb1
/sbin/lilo
exit

The 'chroot' command changes root to /mnt/hdb1, your "new root". When you run lilo, it will execute from the "new root" on /mnt/hdb1, and install your bootloader to the MBR on hdb1.

Hopefully, when you reboot with your new hard-disk, everything should work.
 
Old 04-06-2004, 03:49 AM   #8
iluvatar
Member
 
Registered: Jul 2003
Location: netherlands
Distribution: debian
Posts: 403

Rep: Reputation: 30
hi there!

do not mixup primary / secondary ide connector and master / slave thing... master / slave is just a jumper setting wich doesn't affect the devicelist in linux /dev/ the hda / hdb ( /hdc & hdd) are the different ide channels in your pc. physically swapping the drives is correct for changing their presence in the devicelist. master / slave settings don't do anything in this. after doing the chroot command, grub will install it's config to the master boot record of hdb, the config will be that of hda, so after swapping the drives it would be correct.

greetinz
-= iluvatar =-
 
Old 04-06-2004, 03:59 AM   #9
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,171

Rep: Reputation: 51
when you run chroot with one command after it, you go back to the original root when the command finishes.
if you just did chroot /mnt/hdb1, then you would have to exit

using the cp command isn't as good for tar with such things.
tar clfvp - .|(cd /mnt/hdb1; tar xpf - --same-owner)
copies everything starting in current directory and below to /mnt/hdb1

Last edited by whansard; 04-06-2004 at 04:01 AM.
 
Old 04-06-2004, 07:08 PM   #10
davidas
Member
 
Registered: Mar 2004
Distribution: Debian 'Sarge'
Posts: 168

Original Poster
Rep: Reputation: 30
How does the system differentiate between two harddisks on the same ide channel in the devicelist, of which one is the master and the other is the slave?

Thanks !

Quote:
Originally posted by iluvatar
hi there!

do not mixup primary / secondary ide connector and master / slave thing... master / slave is just a jumper setting wich doesn't affect the devicelist in linux /dev/ the hda / hdb ( /hdc & hdd) are the different ide channels in your pc. physically swapping the drives is correct for changing their presence in the devicelist. master / slave settings don't do anything in this. after doing the chroot command, grub will install it's config to the master boot record of hdb, the config will be that of hda, so after swapping the drives it would be correct.

greetinz
-= iluvatar =-
 
Old 04-06-2004, 09:00 PM   #11
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,171

Rep: Reputation: 51
hda- primary master
hdb-primary slave
hdc- secondary master
hdd-secondary slave

Last edited by whansard; 04-06-2004 at 09:02 PM.
 
Old 04-12-2004, 12:00 PM   #12
davidas
Member
 
Registered: Mar 2004
Distribution: Debian 'Sarge'
Posts: 168

Original Poster
Rep: Reputation: 30
Do I need to tar /proc, /dev, /mnt, lost+found directores and transfer them to the new harddisk? Tar seems to have difficulty archiving /proc and /dev directories. If that is the case, when I boot up on the new harddisk (without transferring /proc and /dev from the old harddisk), will /dev and /proc directories be automatically re-created on the new harddisk?
Or will it won't even boot up?

Thanks !

Quote:
Originally posted by whansard
when you run chroot with one command after it, you go back to the original root when the command finishes.
if you just did chroot /mnt/hdb1, then you would have to exit

using the cp command isn't as good for tar with such things.
tar clfvp - .|(cd /mnt/hdb1; tar xpf - --same-owner)
copies everything starting in current directory and below to /mnt/hdb1
 
Old 04-13-2004, 02:03 AM   #13
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,171

Rep: Reputation: 51
do the whole partition in one shot from a rescue cdrom.
you'll still have to set up the boot loader.
 
  


Reply


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
Copy an entire install to second harddisk seriesx4 Linux - General 7 10-13-2005 11:44 AM
my harddisk is run out space ,what should i do . ztdep Linux - Software 7 08-05-2005 03:16 AM
How to install the slackware linux on the smallest harddisk space agie72 Slackware - Installation 3 01-01-2005 12:54 AM
Installations bigger then 40 gb harddisk kjsubbu Linux - Software 0 09-29-2003 05:58 AM
Emergency - New Harddisk to transfer old data ganninu Linux - Newbie 10 07-23-2003 08:20 AM


All times are GMT -5. The time now is 07:13 PM.

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