Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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:
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?
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.
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!
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.