> my question is, how do i create a raid device (/dev/md3 for example) and
> then put a filesystem on it without losing the current data?

You're nearly there. I don't quite understand something, though. You start with
/home on sda6 and /web on sda7. /dev/md3 contains sda7, so logically you would
put /web on this. But you say you want to put /home on it. Where are you going
to put /web? I would have thought you want a /dev/md5 containing sda6 and sdb6
for /home, and have /web on /dev/md3.

Let's assume you want to put /web on /dev/md3 (you can adapt this if you really
do want /home there). You've created the device. mke2fs it. Mount /dev/md3 on a
spare mount point (let's call it /mnt/newroot). Now copy the files in /web to
that mount-point. You can use Jakob's method in the HOWTO ("cd /web; find
. -xdev | cpio -pm /mnt/newroot"), or you can do "cd /web; tar clf - * | tar
xpfC - /mnt/newroot". Now you should be able to unmount /dev/sda7 and /dev/md3,
and mount /dev/md3 on /web. There you have it - /web on /dev/md3. If this is
working all you have to do is raidhotadd /dev/sda7 to /dev/md3.

You can apply the same logic to any of the other filesystems. For essential
filesystems, such as /, you will have to change /etc/fstab to reflect where you
want the md devices mounted and reboot, rather than just unmount and mount them,
but apart from that, it's the same process.

> i tested this with my /dev/md3, which would be /home.  i unmounted it,
> mkfs /dev/md3, then remounted it, and teh data was gone (not a big deal,
> nothing of importance).

If you already had data on /dev/md3, why did you unmount it and mke2fs it? I
don't think you mean this. If you have just mkraided /dev/md3, you have already
lost the data on any active partitions. mke2fs doesn't make it any worse. But
because the /dev/sda partitions are not active, they still contain the data. So
you simply copy the data across.

> so the md devices are all created and in degraded mode [U_] .
>
> i want to mount the devices, but the system complains that it can't find a
> valid filesystem on it.  but i can't create a valid filesystem without
> destroying the current data.  i must be missing something..

Remember that because the devices are in degraded mode (i.e. the sda halves of
the mirrors are not active), creating filesystems on the md devices will not
affect the sda partitions at this time. So you can go ahead and mke2fs the md
devices without destroying data on the sda partitions.

Cheers,


Bruno Prior         [EMAIL PROTECTED]

> -----Original Message-----
> From: Jonathan Nathan [mailto:[EMAIL PROTECTED]]
> Sent: 17 September 1999 18:59
> To: [EMAIL PROTECTED]; Bruno Prior
> Cc: [EMAIL PROTECTED]
> Subject: RE: root raid problems
>
>
> hello,
>
> i was probably unclear in my previous post.  i had not been able to make
> any raid devices (/dev/md0 was not actually created).
>
> i modified the raidtab as was suggested, removing the raid-disk 1 line and
> just leaving the failed-disk 1 .
>
> i also reformatted/reinstalled the system.  it currently looks like:
>
> /dev/sda1     /boot   32M
> /dev/sda2     /       96M
> /dev/sda3     /var    512M
> /dev/sda4     extended
> /dev/sda5     /usr    1024M
> /dev/sda6     /home   512M
> /dev/sda7     /web    (the rest of the disk)
>
> this is the new raidtab:
>
> raiddev /dev/md0
>       raid-level      1
>       nr-raid-disks   2
>       nr-spare-disks  0
>       chunk-size      8
>       persistent-superblock   1
>       device          /dev/sdb2
>       raid-disk       0
>       device          /dev/sda2
>       failed-disk     1
> raiddev /dev/md1
>       raid-level      1
>       nr-raid-disks   2
>       nr-spare-disks  0
>       chunk-size      8
>       persistent-superblock   1
>       device          /dev/sdb3
>       raid-disk       0
>       device          /dev/sda3
>       failed-disk     1
> raiddev /dev/md2
>       raid-level      1
>       nr-raid-disks   2
>       nr-spare-disks  0
>       chunk-size      8
>       persistent-superblock   1
>       device          /dev/sdb5
>       raid-disk       0
>       device          /dev/sda5
>       failed-disk     1
> raiddev /dev/md3
>       raid-level      1
>       nr-raid-disks   2
>       nr-spare-disks  0
>       chunk-size      8
>       persistent-superblock   1
>       device          /dev/sdb7
>       raid-disk       0
>       device          /dev/sda7
>       failed-disk     1
> raiddev /dev/md4
>       raid-level      1
>       nr-raid-disks   2
>       nr-spare-disks  0
>       chunk-size      8
>       persistent-superblock   1
>       device          /dev/sdb8
>       raid-disk       0
>       device          /dev/sda8
>       failed-disk     1
>
> now, i'm at the point in the howto where it says:
>
> (method 2)
> Now, set up the RAID with your current root-device as the failed-disk in
> the raidtab file. Don't put the failed-disk as the first disk in the
> raidtab, that will give you problems with starting the RAID. Create the
> RAID, and put a filesystem on it.
>
> my question is, how do i create a raid device (/dev/md3 for example) and
> then put a filesystem on it without losing the current data?
>
> i tested this with my /dev/md3, which would be /home.  i unmounted it,
> mkfs /dev/md3, then remounted it, and teh data was gone (not a big deal,
> nothing of importance).
>
> this is my /proc/mdstat :
>
> Personalities : [linear] [raid0] [raid1] [raid5]
> read_ahead 1024 sectors
> md0 : active raid1 sdb2[0] 104320 blocks [2/1] [U_]
> md1 : active raid1 sdb3[0] 530048 blocks [2/1] [U_]
> md2 : active raid1 sdb5[0] 1052160 blocks [2/1] [U_]
> md3 : active raid1 sdb7[0] 530048 blocks [2/1] [U_]
> md4 : active raid1 sdb8[0] 6409792 blocks [2/1] [U_]
> unused devices: <none>
>
> so the md devices are all created and in degraded mode [U_] .
>
> i want to mount the devices, but the system complains that it can't find a
> valid filesystem on it.  but i can't create a valid filesystem without
> destroying the current data.  i must be missing something..
>
> thanks again to all.
>
> jon
>
> --
> Jonathan Nathan
> Web Systems Engineer, CAIS Internet
> [EMAIL PROTECTED]

Reply via email to