Re: Migrating to gmirrored RAID1

2008-08-20 Thread Henry Karpatskij

On 20.8.2008, at 10.48, DA Forsyth wrote:


Good for you.  I see I'm a bit late coming in with my advice, which
is to follow the instructions at
http://www.onlamp.com/pub/a/bsd/2005/11/10/FreeBSD_Basics.html?page=1
with a few mods because you (and I) were not building a new machine.


This is the one I basically followed - I read both that one and the  
freebsddiary one. I decided to reinstall the server though, because I  
was any way going to reinstall world and lots of packages were  
outdated as well. Dumping and restoring would've worked as well, I  
think.



One thing with gmirror is that it won't like to suffer repeated power
failures.  If the time between failures is less than the time it
takes to rebuild the mirror the mirror will break and require manual
fsck and then a rebuild.  This happened to my test server a few weeks
back but today I get to install a UPS for it so this should not
happen again.


OK, good to know. Luckily I have a small UPS which should provide five  
to ten minutes of full power. In Finland the power cuts are quite rare  
and usually measured in mere seconds than minutes, so it's sufficient  
most of the time and if not, apcupsd shuts the server down after few  
minutes if something bigger happens.


--
Henry Karpatskij
http://ripe.net/fcgi-bin/whois?searchtext=HK1203-RIPE

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Migrating to gmirrored RAID1

2008-08-19 Thread Henry Karpatskij

Thanks a lot folks,

I managed to get the server working, only one file could not be read  
from the bad disk, but it wasn't required. It took hours to do it and  
it certainly will remind me next time I choose to be lazy and install  
a server to non-mirrored disk. :-)


--
Henry Karpatskij
http://ripe.net/fcgi-bin/whois?searchtext=HK1203-RIPE

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Migrating to gmirrored RAID1

2008-08-18 Thread Henry Karpatskij

Hi,

I have a failing IDE disk which is running my 7.0-p1 server. I've been  
investigating the possible solutions and I've decided to go with two  
new IDE disks and gmirror. However, I'm not too familiar with disk  
internals, I know how to install the system and somehow understand the  
concept of slices and partitions, but that's about it.


I found some examples on how to install the gmirror on a running  
system, but they all have in common that they just add new spare disk  
to the system and turn on the mirroring to it, but I need to replace  
the current disk which is not the same size as the new ones.


Any suggestions how one would do such an operation? Should I just re- 
install the server to a new disk, turn on the mirroring and then  
restore the configuration and files from the failing disk? Or is it  
easier to add the disks to the running system, turn on mirroring and  
then somehow dump the current disk to the mirror and then re-configure  
it to boot from the gmirror and remove the failing disk?


Current df output:

Filesystem  1K-blocksUsedAvail Capacity  Mounted on
/dev/ad0s1a507630  159262   30775834%/
devfs   1   10   100%/dev
/dev/ad0s1e507630  56   466964 0%/tmp
/dev/ad0s1f  33573476 6044408 2484319020%/usr
/dev/ad0s1d   1762414  381632  123979024%/var
devfs   1   10   100%/var/named/dev

Thanks in advance,

--
Henry Karpatskij
http://ripe.net/fcgi-bin/whois?searchtext=HK1203-RIPE

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Migrating to gmirrored RAID1

2008-08-18 Thread Ivan Voras
Henry Karpatskij wrote:
 Hi,
 
 I have a failing IDE disk which is running my 7.0-p1 server. I've been
 investigating the possible solutions and I've decided to go with two new
 IDE disks and gmirror. However, I'm not too familiar with disk
 internals, I know how to install the system and somehow understand the
 concept of slices and partitions, but that's about it.
 
 I found some examples on how to install the gmirror on a running system,
 but they all have in common that they just add new spare disk to the
 system and turn on the mirroring to it, but I need to replace the
 current disk which is not the same size as the new ones.
 
 Any suggestions how one would do such an operation? Should I just
 re-install the server to a new disk, turn on the mirroring and then
 restore the configuration and files from the failing disk? Or is it
 easier to add the disks to the running system, turn on mirroring and
 then somehow dump the current disk to the mirror and then re-configure
 it to boot from the gmirror and remove the failing disk?

If the new drives have the same size as the old one, you could do it
gradually:

- Mirror the old drive to new drive #1
- Replace the old drive with new drive #2, mirror it from new drive #1

If the sizes are different, this won't work and the best would be to
install a fresh system on a new drive and transfer the configuration
from the old one.

Booting will always happen from a single drive. Since up to the point
file systems are mounted all relevant drive access is read-only, the
BIOS will happily boot one of the mirrored pair, then the kernel will
pick up and activate mirroring before file systems are mounted.

This is why all instructions start with one drive and later add a new
drive to hold the mirror; it's easy to set up a single drive and then
simply mirror it.



signature.asc
Description: OpenPGP digital signature


Re: Migrating to gmirrored RAID1

2008-08-18 Thread John Nielsen
On Monday 18 August 2008 05:39:10 am Henry Karpatskij wrote:
 Hi,

 I have a failing IDE disk which is running my 7.0-p1 server. I've been
 investigating the possible solutions and I've decided to go with two
 new IDE disks and gmirror. However, I'm not too familiar with disk
 internals, I know how to install the system and somehow understand the
 concept of slices and partitions, but that's about it.

 I found some examples on how to install the gmirror on a running
 system, but they all have in common that they just add new spare disk
 to the system and turn on the mirroring to it, but I need to replace
 the current disk which is not the same size as the new ones.

 Any suggestions how one would do such an operation? Should I just re-
 install the server to a new disk, turn on the mirroring and then
 restore the configuration and files from the failing disk? Or is it
 easier to add the disks to the running system, turn on mirroring and
 then somehow dump the current disk to the mirror and then re-configure
 it to boot from the gmirror and remove the failing disk?

I think the latter approach is easier and makes the most sense for your 
situation. Install the disks, set up the mirror(s) that you want, 
transfer data and then do a boot test.

Something along these lines should work. Substitue device and volume names 
to match your hardware and tastes.
#set up a single mirror to use the whole disk (versus mirroring 
individual slices/partitions)
gmirror label myraid1 /dev/ad4 /dev/ad6
#install a partition table and the boot0 code
fdisk -BI /dev/mirror/myraid1
#install a default label and the main boot code
bsdlabel -wB /dev/mirror/myraid1s1
#create BSD partitions by hand. remember to set EDITOR if you don't 
like 
vi
bsdlabel -e /dev/mirror/myraid1s1
#This is the tricky part. Create the partitions you want on the mirror. 
Use the output of bsdlabel /dev/ad0s1 as a guide. Remember that a 
should be root, b is traditionally swap, c is the raw partition and 
should not be changed, and d - h are other partitions. I find a 
spreadsheet to be handy for figuring out the correct values, though a 
calculator is adequate (I've used dc more than once..). The units you are 
dealing with are 512-byte sectors. Best practice (which sysinstall 
doesn't follow but bsdlabel -w does) is to leave 16 sectors at the start 
of the slice for the boot code (but both swap and UFS will avoid 
clobbering it even if you don't do this). If you follow the best practice 
and do the partitions in order, then the offset for a is 16, and the 
offset for any other partition is the offset of the previous one plus the 
size of the previous one. Assuming your last filesystem wants to use the 
remainder of the slice, figure its offset as above then subtract it from 
the total (the size of c) for the size. For filesystem partitions the 
fstype should be 4.2BSD, and use 2048 16384 0 for the last three 
columns unless you have reason to do otherwise. (The bps is recalculated 
when you create a filesystem so it won't be 0 later. That's expected.) 
The fstype for swap space is swap and the last three columns are 
omitted. Save and exit the editor when finished.)
#Create filesystems
newfs /dev/mirror/myraid1s1a
#(repeat for other filesystems, changing the partition letter as 
appropriate)
#Make temp mountpoints
mkdir /newroot
#(again repeat as needed)
#Mount new filesystems
mount /dev/mirror/myraid1s1a /newroot
#(repeat as needed)
#Dump/restore filesystems
cd /newroot
dump -0 -L -C32 -f - / | restore -r -f -
rm restoresymtable
#(repeat as needed, changing the filesystem argument to dump and the 
cwd 
for your new filesystems. one or two messages from restore about getting 
a different inode than expected is normal.)
#edit /newroot/etc/fstab. Change the device for / 
to /dev/mirror/myraid1s1a. Make a similar change for other filesystems.
#edit /newroot/boot/loader.conf. Make sure it includes this line:
geom_mirror_load=YES
#shut down, remove the original disk, and try booting

Good luck!

JN

 Current df output:

 Filesystem  1K-blocksUsedAvail Capacity  Mounted on
 /dev/ad0s1a507630  159262   30775834%/
 devfs   1   10   100%/dev
 /dev/ad0s1e507630  56   466964 0%/tmp
 /dev/ad0s1f  33573476 6044408 2484319020%/usr
 /dev/ad0s1d   1762414  381632  123979024%/var
 devfs   1   10   100%/var/named/dev

 Thanks in advance,


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]