LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 01-13-2005, 11:57 PM   #1
compu73rg33k
Member
 
Registered: Feb 2004
Distribution: Ubuntu
Posts: 316

Rep: Reputation: 30
mirror IDE harddrive


I currently have a 15 GB hdd for my server and it's getting full so I bought a 200 GB one. I don't want to have ot install everyhting becuaes I have it all set as I want like my apache, php, mysql everything. THey're both ide hdds and I was wondering how I would make a mirror of my 15 GB hdd to my new 200 GB one.
 
Old 01-14-2005, 02:52 AM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
No replies yet?

There's all kinds of high-falutin' gizmos for doing industrial-style mirroring but if you mean you just want to make a copy of your system, look into rsync and remember to touch up any configs due to any differences, such as fstab adjustments.

Or maybe just 'cp -a' the whole thing.
 
Old 01-14-2005, 04:48 AM   #3
mritch
Member
 
Registered: Nov 2003
Location: austria
Distribution: debian
Posts: 667

Rep: Reputation: 30
have a look at parted. i use it to copy the whole partition to another disk. read the man page.

boot with a knoppix or something like this and partition the second drive. then use parted to copy partitionX from the old drive to the (bigger) partitionY on the new one. mount and chroot into the new partition and edit your bootloader to boot into the new root partition. edit /etc/fstab to reflect your new filesystem layout. when everything works you can delete your old partition.

if you keep your old drive it might be wise to just put /usr (usually the biggest dir) onto the new drive. cp -a (like digiot suggested) will do it. edit fstab to your needs and your'e done.

sl mritch.
 
Old 01-14-2005, 02:13 PM   #4
compu73rg33k
Member
 
Registered: Feb 2004
Distribution: Ubuntu
Posts: 316

Original Poster
Rep: Reputation: 30
Alright I want to try the cp -a way. I haven't done anythign to the harddrive except installed it. Do I need to partition it the same way my other one is or how would I go about doing this. What command would I execute with like the arguments. cp -a / /dev/hdf ??? /dev/hdf is the new harddrive and /dev/hde is the one I have now.
 
Old 01-14-2005, 04:55 PM   #5
mritch
Member
 
Registered: Nov 2003
Location: austria
Distribution: debian
Posts: 667

Rep: Reputation: 30
use a tool like fdisk, cfdisk (grapical) or parted and partition your drive:

# fdisk /dev/hdf (your new one)

make a primary partition for your new filesystem and eventually one for some additional swapspace. up to four primary and much more extented are possible. then put a filesystem onto it: (ext3 here)

# mke2fs -c -j /dev/hde1

and swap on the other (small):

# mkswap -v1 /dev/hde2

mount /dev/hde1 to /mnt/new_drive (<- dir. must exist):

# mount -t ext3 /dev/hde1 /mnt/new_drive

copy over the data from your old /usr to the new disk:

# cd /usr; cp -a ./* /mnt/new_drive/

edit your fstab so /dev/hde1 points to /usr (ext3 defaults) and add the new swap with the same priority (pri=1 for both swaps) there. move (mv) your old /usr to /usr_old and make a new directory (mkdir) /usr for the mounted new partition - it will be there after a reboot. reboot. check if everything is fine ($ mount) and finally delete your /usr_old.

read the manpage of the program/file if something isn't clear to you.

sl mritch.

Last edited by mritch; 01-14-2005 at 04:57 PM.
 
Old 01-15-2005, 04:19 PM   #6
compu73rg33k
Member
 
Registered: Feb 2004
Distribution: Ubuntu
Posts: 316

Original Poster
Rep: Reputation: 30
Okay this is really weird. I did cfdisk /dev/hdf and it comes up as if it's /dev/hde the old hdd with the same partitions. I do cfdisk /dev/hde and it's the same thing....
 
Old 01-15-2005, 05:18 PM   #7
mritch
Member
 
Registered: Nov 2003
Location: austria
Distribution: debian
Posts: 667

Rep: Reputation: 30
?post more info. check dmesg output about found drives/partitions and send in a "fdisk -l" from your drives too.

sl mritch.

i just looked at my post above and noticed i interchanged hde with hdf after the second step (watch out :)

Last edited by mritch; 01-15-2005 at 05:24 PM.
 
Old 01-15-2005, 06:59 PM   #8
compu73rg33k
Member
 
Registered: Feb 2004
Distribution: Ubuntu
Posts: 316

Original Poster
Rep: Reputation: 30
The information for fdisk -l /dev/hde and /dev/hdf are the exact same. It's like reading the new hdd as if it's the other one or something..

device boot start end blocks ID System
/dev/hde1 * 1 25207 12704296+ 83 Linux
/dev/hde2 25208 26353 577584 f W95 Ext'd (LBA)
/dev/hde5 25208 26353 577584 82 swap

Tha'ts also what comes up for /dev/hdf only the devices have /dev/hdf1 /dev/hdf2 and /dev/hdf5
 
Old 01-15-2005, 09:09 PM   #9
mritch
Member
 
Registered: Nov 2003
Location: austria
Distribution: debian
Posts: 667

Rep: Reputation: 30
hmm.. give us some information about your system.
what does dmesg say about the ide controller and harddrives? how's your drive-layout/hardware? any cdroms (and if, check if master/slave is set correctly)? does the drive get recognized by the bios? sata-controller or standard ide? what's on your primary and secondary controller (usually the onboard ide)?

sl mritch.
 
Old 01-15-2005, 09:59 PM   #10
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Norton Ghost will work with ext3 but if you are using a different filesystem. You can use the tools from system rescue cd site. The command cp -a will work, but it will go to another partition if you do not specify the option x. If you do cp -ax, it will not copy other partition that is mouted on certain directories like /home. Using the cp to copy the whole entire Linux drive will not be very good because you have to be in single user mode or runlevel 1. The syslogd and other programs should not be running in single user mode. If you really want to make sure data is copied with out any problems or corruption, use a Live Linux CD distribution like Knoppix to copy the two drives. Of course you have to mount the two drives in Knoppix.

Using just fdisk -l should give you a list of your hard drive setup. If that does not work, try fdisk -l /dev/hd[a-z].

TIP: Place your swap first to improve its performance when used. Also to increase its performance even more. Make a swap partition on two hard drives and make sure their capacity is the same. Next in fstab file specify same pri for each hard drive. Linux will do RAID 0 automatically for the swap partitions, so need to use mkraid specifying a hex number to set the type of partition as RAID. This really speed of copying data from memory to the swap.
 
Old 01-15-2005, 10:19 PM   #11
Travers
Member
 
Registered: Jul 2004
Location: Des Moines
Distribution: Gentoo
Posts: 111

Rep: Reputation: 15
Hey, Electro, good tips for speeding up swap. Never heard of them before. Thanks.
 
Old 01-16-2005, 12:44 AM   #12
mritch
Member
 
Registered: Nov 2003
Location: austria
Distribution: debian
Posts: 667

Rep: Reputation: 30
i noticed better troughput/seek by putting the swaps more to the middle of the drive. iirc beginning and end of the drive have less troughput and higher seektimes. the swaps don't have to be the same size, just the priority has to be the same.

sl mritch.

Last edited by mritch; 01-16-2005 at 12:46 AM.
 
Old 01-18-2005, 10:04 PM   #13
compu73rg33k
Member
 
Registered: Feb 2004
Distribution: Ubuntu
Posts: 316

Original Poster
Rep: Reputation: 30
Alright well I have all the info copied I did a cp -a ./* /mnt/new_drive so it has all the information. Just one problem thoguh. I installed Grub on the old harddrive to the MBR. Is there a way I can copy the MBR or do I have to boot from a bootdisk and reinstall Grub?
 
Old 01-18-2005, 11:03 PM   #14
mritch
Member
 
Registered: Nov 2003
Location: austria
Distribution: debian
Posts: 667

Rep: Reputation: 30
both ways should work. edit your grub configuration and/or fstab if your new layout differs from your old.

mritch.
 
Old 01-20-2005, 04:50 PM   #15
compu73rg33k
Member
 
Registered: Feb 2004
Distribution: Ubuntu
Posts: 316

Original Poster
Rep: Reputation: 30
Bah I just installed Debian and then copied all my config files over that i needed. Was much less work lol
 
  


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
IDE internal harddrive options Proud Linux - Hardware 3 04-15-2005 07:19 AM
Installing linux on 2nd harddrive(dual boot) windows on seperate harddrive lysol Linux - Software 25 08-03-2004 09:33 AM
Are UATA IDE Drivers needed in Linux to enable UDMA Harddrive modes? linux-fan64 Linux - Hardware 1 02-25-2004 04:04 PM
IDE Harddrive issues SLaCk_KiD Linux - Hardware 4 09-23-2003 06:28 PM
harddrive mirror tincat2 Debian 6 07-25-2003 03:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 09:24 PM.

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