LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] New Hard Disc

[ILUG] New Hard Disc

Niall O Broin niall at linux.ie
Fri Jun 21 23:49:14 IST 2002


On Fri, Jun 21, 2002 at 06:50:59PM +0100, Tom Mackey wrote:

> The disc in my Linux machine is almost full and I would like to replace it 
> with a larger one.  I can add the new dics to the machine and have it running 
> temporarly on the same IDE as the existing.  How do I copy across all the 
> content of the old disc including boot sector, all existing setup etc?  The 
> existing disc is just one / partition (+swap).  I have tried Google but 
> failed to find a solution.

To my mind the optimum way to do this is with a bootable CD e.g. the ILUG
BBC (dated support for filesystems so may not work for you) or a current
distribution's CD in "rescue" mode. The following step by step instructions
assume that you're using hda and hdb and that the root partition is
partition 1 and the swap is partition 2


Install the new disk as the master
Configure the old disk as slave
Boot from rescue CD
Run  fdisk /dev/hda   and partition as desired
Reboot from rescue CD 	  	       	      [1]
mkdir /tmp/old /tmp/new			      
mke2fs -m0 /dev/hda1			      [2]
mkswap /dev/hda2
mount /dev/hda1 /tmp/new
mount /dev/hdb1 /tmp/old
cd /tmp/old
find .|cpio -pmd /tmp/new		      [3]
lilo -r /tmp/new 			      [4]
remove CD and reboot from new disk
System verified - shutdown and remove old disk if desired.

Notes

[1] Perhaps not strictly necessary, but it never hurts to reboot after
changing partition tables. I generally DON'T do it but I recently had a
little glitch on a machine where I had changed a partition table which was
only resolved by a reboot.

[2] You may of course want to use some other filesystem type.

[3] cp -a . /tmp/new is probably just fine too - I've just been using
find|cpio since forever and it works on any Unix while -a is NOT a
universally available switch to cp.

[4] If your /etc/lilo.conf file makes reference to the geometry of your disk
you'll need to change that.


What if you don't have a bootable CD ? Get one :-) Without, it's a bit
messier. You'll have to install the new disk as slave, partition and make
filesystem, copy the root partition to the new disk while the old disk is
running (not that bad with Linux, but be sure to avoid copying /proc), make
a boot floppy, shut down the machine, swap the disks around, boot from the
boot floppy and run lilo again. The boot CD is handier.

You can possibly avoid the boot floppy stage if you get into some advanced
lilo voodoo. If you knew those incantations (I don't - I imagine it's
doable, but I avoid it by using a rescue CD), you wouldn't be asking the list
this question.



Have fun,



Niall


P.S. Be very careful with your hda, hdb, old, new etc. - severe potential
for obliterating your existing data if you get things mixed up.

P.P.S. Above comes with no guarantees. If it breaks, you get to keep all the
pieces.




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell