LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-28-2004, 04:31 AM   #1
supra92
LQ Newbie
 
Registered: Dec 2004
Posts: 5

Rep: Reputation: 0
moving hard drive with existing data to FC3


All,

How does one move an ext3-formatted hard drive that has existing data on it to a new installation?

I sat down today at my 3-year-old Red Hat 7.2 firewall box to redo it by installing Fedora Core 3. The existing 7.2 firewall (unfortunately) had a personal data store on it, so I wanted to save this before waxing the box. In a nutshell, here was the partition layout:

20GB Maxtor --- held /var and /briansdata
4GB WD --- held everything else, including /

Basically what I want to do is yank out the 20GB Maxtor, and slap it into another FC3 server (Mozart) I already have running.

However... there is a /var on that Maxtor, and I know that's going to conflict with the /var that's already on Mozart.

What are the steps I need to take in order to use that 20GB Maxtor and its /briansdata filesystem on Mozart, without having to back all the data up to CD, format the drive, then copy it all back over?

Thanks!
Brian
 
Old 12-28-2004, 07:16 AM   #2
drowstar
Member
 
Registered: Apr 2004
Location: Germany
Distribution: Slackware, Gentoo, Fedora
Posts: 205

Rep: Reputation: 30
Hi Brian,
if I understand you correctly what you want to do won't be a problem.
It would help to know what the /etc/fstab file on the 7.2 box looks like.

Quote:
However... there is a /var on that Maxtor, and I know that's going to conflict with the /var that's already on Mozart.
Well, you are wrong, fortunately. When you move the hard drive to the other server it can be mounted to any directory you want (not necessarily to /var). I don't know what kind of "help" (as it's more of an obstacle this time) Fedora provides for this kind of thing. The low-level solution would be to add a line like this to the /etc/fstab file on Mozart:
Code:
/dev/hdb1       /mnt/oldvar           ext3        defaults           0  0
This assumes the other harddrive will be recognised as hdb and the var partition is the first one on the drive. If you do it this way you will be able to access your old /var data at /mnt/oldvar (make sure this directory exists). Don't add this line if you are willing to give up the space /var took up on the old drive and you are sure you won't need any of the files at a later time.

You can preserve /briansdata by adding a line similar to this one:
Code:
/dev/hdb2       /briansdata           ext3        defaults           0  0
I hope this solves your problem,
- drowstar

P.S.: You can always delete the /var partition before you put the drive in Mozart.
 
Old 12-28-2004, 12:55 PM   #3
supra92
LQ Newbie
 
Registered: Dec 2004
Posts: 5

Original Poster
Rep: Reputation: 0
Hi Drowstar,

I do have the fstab file saved from the old firewall box (called Hurstwood). Here it is:

LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
/dev/hdb2 /mnt/fileserver ext3 defaults 1 2
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/hdb1 /var ext3 defaults 1 2
/dev/hda5 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0

This actually concerns me, because I don't see any hdb listed in it. When i was preparing to move my drive, all i did was a "df" command, which showed the various partitions and what was available/used on them. I am 100% positive that when i did the 'df' command, that only /var and "/briansdata" (it's actually "/mnt/fileserver", i was simplifying the name for clarity) showed up on hdb. hda is the 4GB WD, and hdb was the 20GB Maxtor.

The problem is that I believe I've done what you suggested which is this:

1. Without the 20GB Maxtor in the new server (Bach), I went to Bach's fstab and edited it. It used to be this:

LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
LABEL=/home /home ext3 defaults 1 2
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/var /var ext3 defaults 1 2
/dev/hdb1 /var/www/html ext3 defaults 1 2
/dev/hdb2 /mp3s ext3 defaults 1 2
/dev/hda3 swap swap defaults 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0

but I then added these two lines:

/dev/hdc1 /oldvar ext3 defaults 1 2
/dev/hdc2 /oldfileserver ext3 defaults 1 2

I got a slew of errors on bootup (which i don't recall, but can get again if necessary), so it dumped me to an emergency shell, I edited the fstab file to remove those two lines, and continued.

However... bear in mind now that the 20GB Maxtor is still in the new server, altho nothing on fstab points to it anymore. To me, this means that Bach should just ignore it entirely and boot up fine. Unfortunately, that doesn't happen....

During bootup, i get this error:
"Mounting local filesystems: mount: LABEL=/var duplicate = not mounted [failed]"

I then proceed to get a slew of errors about not finding:
"/var/run/utmp
"/var/log/wtmp"
since, obviously, /var isn't mounted.

Why does the Maxtor's presence when nothing in fstab points to it cause all these errors?

One last item: when I originally added the two lines for hdc.... I made the two last numbers "1 2". You stated they should be "0 0", does this make a difference?

Thanks very much!
Brian
 
Old 12-28-2004, 01:25 PM   #4
supra92
LQ Newbie
 
Registered: Dec 2004
Posts: 5

Original Poster
Rep: Reputation: 0
If this helps, I am posting what happens when i DO add the two lines to my /etc/fstab on Bach. Here is fstab as it currently stands:

LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
LABEL=/home /home ext3 defaults 1 2
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/var /var ext3 defaults 1 2
/dev/hdb1 /var/www/html ext3 defaults 1 2
/dev/hdb2 /mp3s ext3 defaults 1 2
/dev/hdc1 /oldvar ext3 defaults 0 0
/dev/hdc2 /oldfileserver ex3 defaults 0 0
/dev/hda3 swap swap defaults 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0


Upon bootup, here are the errors i get:

Checking filesystems
/var: clean, 597/513024 files, 37018/1024135 blocks
/boot: clean..... yada
/dev/hdb1: clean, .... yada
/home: clean, .... yada
/dev/hdb2: clean..... yada

Mounting local filesystems: mount: LABEL=/var duplicate -- not mounted [FAILED]
Enabling local filesystem quoats: [OK]
/etc/rc.d/rc.sysinit: line 639: /var/run/utmp: No such file or directory
chgrp: failed to get attributes of '/var/run/utmp': No such file or directory
chgrp: failed to get attributes of '/var/log/wtmp': No such file or directory
chmod: failed to get attributes of '/var/run/utmp': No such file or directory
chmod: failed to get attributes of '/var/log/wtmp': No such file or directory
Enabling swap space: [OK]
/etc/rc.d/rc.sysinit line 789: /var/log/dmesg: No such file or directory
/etc/rc,d/rc.sysinit: line 807: /var/log/ksyms.0: No such file or directory

and after that, it just stops and hangs.

So clearly, it checks /var and it comes out fine. But when it tries to mount it, it somehow "sees" the old /var on the Maxtor, even tho the partition on Maxtor that had it (hdb1 on the old firewall) is now referred to as /dev/hdc1 --> hurstwoodvar

Does this shed any further light, hopefully?

FYI, Bach is a stock Red Hat 9 box, not FC3. The Maxtor is coming from an old 7.2 firewall.

Thanks,
Brian

Last edited by supra92; 12-28-2004 at 01:28 PM.
 
Old 12-28-2004, 02:51 PM   #5
supra92
LQ Newbie
 
Registered: Dec 2004
Posts: 5

Original Poster
Rep: Reputation: 0
SOLVED

Well, I figured it out, after about 5 hours of researching and hammering at it.

Apparently, even tho i'm telling Bach (through fstab) to consider the Maxtor's two partitions as /oldvar and /oldfileserver, that's not enough. Bach is still seeing what should be /oldvar by its original name on the old firewall, which was /var.

The solution wound up being as follows:

1. From GRUB, modify the kernel parameter to add "single" at the end, to boot to linux single mode.

2. Let the /var duplication failure happen again in the bootup sequence.

3. But since in linux single mode, when it fails, it dumps me to a bash prompt.

4. I used e2label to rename the partitions as follows:
e2label hdc1 /oldvar
e2label hdc2 /oldfileserver

5. I then rebooted in normal mode, and presto --- bootup sequence went fine, and I now have the 20GB Maxtor visible on Bach at the /oldvar and /oldfileserver partitions :-)



Lesson learned: Linux still looks at the actual label assigned on the drive itself when mounting filesystems --- calling a partition something in fstab alone is not sufficient (presumably this is true only if it involves a system path like /home or /var, etc.)

Thanks for your help on this, glad to have Bach up and running. Hopefully others will benefit from this experience I went through!

Regards,
Brian
 
Old 12-28-2004, 02:56 PM   #6
drowstar
Member
 
Registered: Apr 2004
Location: Germany
Distribution: Slackware, Gentoo, Fedora
Posts: 205

Rep: Reputation: 30
Hi Brian,
glad it worked for you. Sorry I wasn't fast enough to help you. Darn, I almost had my next post done

Good luck,
- drowstar
 
Old 12-28-2004, 03:09 PM   #7
supra92
LQ Newbie
 
Registered: Dec 2004
Posts: 5

Original Poster
Rep: Reputation: 0
No problem at all -- everyone likes to see a happy ending!

I just quite appreciate the help -- i put in that post late last night before bed, and got up this AM and you had already responded with some help. That kind of resource is invaluable, just knowing there are people out there who are willing to listen and assist, and in a timely fashion no less. Now I need to read the forums some more in search of a question I can help on

Oh yeah, and I suppose the final lesson learned (per usual!): backup! This time worked out great, but if somehow I'd lost all those personal files and emails and programming snippets and pictures and etc., i'd have been crushed. REALLY have to get moving on a decent backup solution, either a tape or DVD burning setup.

Cheers to you,
Brian
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mounting existing drive with data martli SUSE / openSUSE 6 11-19-2005 07:48 PM
How to install a new hard drive on to existing system ksgill Linux - Newbie 3 02-07-2005 12:17 AM
Moving data to another hard disk. wenberg Slackware 10 06-20-2004 11:17 PM
Partitioning existing hard drive NickC Linux - Hardware 4 12-09-2003 04:44 AM
Add a new hard drive to existing RH 7.2 guanyu Linux - Software 1 02-27-2002 10:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:12 AM.

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