Re: Transfering my system to a new disk (was: Root partition stuck in read-only mode.)
On Sat, Feb 01, 2003 at 01:29:53AM -0500, Lloyd Zusman wrote:
> Quoting Nathan E Norman <nnorman@incanus.net>:
>
> > On Fri, Jan 31, 2003 at 11:59:28PM -0500, Lloyd Zusman wrote:
> > >
> > > [ ... ]
> > >
> > > So ... now that things are sort of back to normal, my question
> > > is this: what caused the filesystem to become read-only to
> > > begin with? Could it be hardware errors? The fact that the
> > > fsck found no errors seems to point to this as a possible cause,
> > > correct?
> >
> > No, hardware errors would cause fs corruption I think. Probably the
> > fact that the options field was blank caused the problem. In the
> > future, make sure that field says "defaults" if you have nothing else
> > to put in there :-)
>
> Well, it does say "defaults" now, and I rebooted with it set that
> way. But a few minutes ago I started getting disk error after disk
> error. So I think that I do indeed have some hardware problems,
> after all [sigh].
Gack!
How old is the drive? Any chance the issue is termination or a
misconfigured jumper? You're using an Adaptec 2940?
> So now, I have a completely new question:
>
> I belive that the error is on my first drive, the /dev/sda drive
> on SCSI channel 0. My second drive (/dev/sdb, SCSI channel 1)
> seems fine. Assuming I can boot up and run reliably for a while,
> I want to copy everything from /dev/sda to the top level of
> /dev/sdb. Then, I'd like to reset my system to boot off of
> the second drive (which has plenty of empty space).
>
> I think I should do something like this (but I'm not sure if this
> is correct):
>
> 1. My /dev/sdb only has one partition, and I have mounted it as
> /opt. So what I'll do is create an /opt subdirectory on that
> drive and move everything from /dev/sdb1 there.
Sounds good.
> 2. I should use tar to copy all the filesystems under root,
> except for /opt, over to the /dev/sdb1 partition. This should
> copy links and permissions correctly. [Is that true?]
Use tar if you like, but I personally would use find and cpio to do
this. The command is "find / -xdev | cpio -padm /mnt". The "-xdev" only
finds files on the root partition, the one you are backing up. Running
the commands as root ensures that you preserve permissions and
ownership. Replace "/mnt" with "/opt" if you've left /dev/sdb1
mounted there.
> 3. I should change /etc/fstab on the second partition to only
> have one huge partition (i.e., get rid of the /usr, /home,
> and other mount points).
OIC ... all partitions are on /dev/sda except for /opt? Hmm, that
complicates things a bit. In that case my command above would change
to "find / -fstype ext2 | grep -v '^/opt/' | cpio -padm /opt". Here I
assume you've left /dev/sdb1 mounted on /opt. I also changed find so
it recurses into all filesystems that are ext2 (replace wiuth ext3 if
that's what you're using) ... I do this so we don't recurse into
/proc. If you have some eclectic mix of filesystems you could do away
with the "-fstype" option to find and replace the grep with a more
complex one:
find / -fstype ext2 | grep -vE '^/(opt|proc)/' | cpio -padm /opt
Note in either case the trailing '/' in the regex; this copies the
mount point but nothing in the mount point.
> 4. ???????? I need to create a proper boot sector on the
> /dev/sdb1 partition. How do I do that?
>
> 5. ???????? I configure my system to boot off of /dev/sdb1
> instead of off the faulty drive.
>
> Does this sound reasonable? If not, can anyone suggest what I'm
> missing? And I'd be grateful if someone could explain how to do
> steps 4 and 5.
>
> Thanks again for the earlier help, and thanks in advance for any
> help you might be able to offer for this new system-copy task.
This may prove difficult. Why not just remove /dev/sda once you've
copied stuff over? Then, if you run LILO boot wiuth a rescue floppy
and/or CD, type "linux root=/dev/sda1" at the prompt, and rerun lilo
once you're up.
If you use GRUB, it would be a good idea to make a grub boot floppy;
then you can boot to any kernel on any drive in the system! Google
for this or ask me; I'll look around for my link.
If you don't remove /dev/sda, you're going to have to depend on it to
provide a master boot record to boot the rest of the system. Since
you don't trust that drive this seems unwise.
Above all, _plan_ and make sure you are _comfortable_ wiuth what you
are about to do. If you have a tape backup, use it. If you have a cd
writer, burn a bunch of CDs with your data.
--
Nathan Norman - Incanus Networking mailto:nnorman@incanus.net
prepBut nI vrbLike adjHungarian! qWhat's artThe adjBig nProblem?
-- alec flett @netscape
Reply to: