LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-18-2003, 04:14 PM   #1
linuxnube
Member
 
Registered: Oct 2003
Location: US
Distribution: Fedora C1 & C2
Posts: 81

Rep: Reputation: 15
How to upgrade harddrive


I have rh installed with several users. This is a server machine running postfix (and soon imp).

I have two tasks I would like to do.

1) make an exact duplicate of the system on another harddrive.
Can I just make a similar partition layout and then just dd if=xxx of=xxx for each partition? If not, how can I do this? It needs to maintain accounts and passwords as I want to be able to bring up a replacement machine when I have this one down.

2) Install a new version of linux on a new harddrive and copy the exiting accounts and passwords.
Is this as simple as coping the /home directory and password files? If not, what?

Thanks again.
 
Old 12-18-2003, 04:43 PM   #2
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
Question one:

dd does an exact copy including partition size, so you might prefer something more flexible. Here are some instructions I wrote for myself when I got a new drive.

# Clone a distro to another drive or move directories around
Install drive in box (assuming IDE1 slave for examples) and ensure BIOS can detect it. Boot into Linux and login to your user's account. Open an x terminal and partition and format the new drive as you wish
Code:
[fancy@tinwhistle fancy]$ su -
Password: 
[root@tinwhistle root]# fdisk /dev/hdb
Exit with w to write the partition table.

Format the partitions with the chosen filesystems:
mke2fs /dev/hdbX -> ext2
mke2fs -j /dev/hdbX -> ext3
mkswap -> swap
mkreiserfs -> reiserfs
mkfs.xfs -> xfs

Make directories for source and destination mount points. You need these to keep out of an endless loop of copying itsself over and over.
Code:
[root@tinwhistle root]# mkdir /mnt/source
[root@tinwhistle root]# mkdir /mnt/destination
Mount your os partitions that you want to clone on /mnt/source
Mount your partitions on the new drive, making directory entries for your separate partitions (/boot, /home, /var etc.). If you are just copying a directory such as var, just cd to the directory you wish to copy instead of mounting partitions on /mnt/source.

Now, cd to /mnt/source and pipe it over with tar
Code:
[root@tinwhistle root]# cd /mnt/source
[root@tinwhistle source]# tar cf - . | (cd /mnt/destination && tar xBfp -)
Edit /etc/fstab as needed, install your boot loader when the drive is installed in it's final position (if you moved a whole distro), and it should work.

Perhaps someone else can help with Q2.

Last edited by fancypiper; 12-18-2003 at 04:54 PM.
 
Old 12-18-2003, 04:46 PM   #3
miaviator278
Member
 
Registered: Dec 2003
Location: Al-Diwania, Iraq (deployed)
Distribution: Slackware ONLY
Posts: 237

Rep: Reputation: 30
#2 copying /etc/passwd would work, aside from the shadow file, otherwise you can copy home directories, and then create new users..

#1 read the following man pages
man dd
man tar

check out gnu parted at www.icewalkers.com or any freeware site, also qtparted for gui buffs, if you still have questions post again...
 
  


Reply



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
Installing linux on 2nd harddrive(dual boot) windows on seperate harddrive lysol Linux - Software 25 08-03-2004 09:33 AM
Debian Kernel Upgrade from 2.4.26-1-386 to 2.6.6-2-k7 harddrive preformance issues. Cohobin Linux - Software 0 06-29-2004 08:56 PM
upgrade RH8 to RH9 - upgrade or clean install PAB Linux - General 0 03-13-2004 03:55 PM
Need to replace full harddrive with new, larger harddrive pearlr Linux - Newbie 1 01-02-2004 12:59 PM
Error trying to dist-upgrade or upgrade KDE prophet621 Linux - Newbie 0 09-10-2003 04:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:13 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
Open Source Consulting | Domain Registration