From owner-freebsd-questions Fri Mar 14 21:58:33 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EC12237B401 for ; Fri, 14 Mar 2003 21:58:26 -0800 (PST) Received: from wantadilla.lemis.com (wantadilla.lemis.com [192.109.197.80]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2904443FAF for ; Fri, 14 Mar 2003 21:58:23 -0800 (PST) (envelope-from grog@lemis.com) Received: by wantadilla.lemis.com (Postfix, from userid 1004) id C8E5051A58; Sat, 15 Mar 2003 16:28:20 +1030 (CST) Date: Sat, 15 Mar 2003 16:28:20 +1030 From: Greg 'groggy' Lehey To: Malcolm Kay Cc: freebsd-questions@FreeBSD.org Subject: Re: vinum based system Message-ID: <20030315055820.GS90698@wantadilla.lemis.com> References: <200303151623.03287.Malcolm.Kay@internode.on.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fberPwKQctZF/fXp" Content-Disposition: inline In-Reply-To: <200303151623.03287.Malcolm.Kay@internode.on.net> User-Agent: Mutt/1.4i Organization: The FreeBSD Project Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.FreeBSD.org/ X-PGP-Fingerprint: 9A1B 8202 BCCE B846 F92F 09AC 22E6 F290 507A 4223 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --fberPwKQctZF/fXp Content-Type: multipart/mixed; boundary="nccO0ldXW0cuDU6a" Content-Disposition: inline --nccO0ldXW0cuDU6a Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Saturday, 15 March 2003 at 16:23:03 +1030, Malcolm Kay wrote: > I am planning to put up a FreeBSD system, probably 4.8-RELEASE > when it appears, to manage backups from a number of Unix and unix-like > systems on a LAN. > > Backups will be written nightly over the LAN to a local disk system and > transfered regularly to tape via a scsi tape-drive. > > I am under pressure to make this system fairly reliable with respect > to hardware failure - particularly disk drives. The thought is to use a couple > of fairly large drives, say 120 or 160Gb running as a mirrored pair using > vinum. Having no experience with vinum or software RAID systems a number > of questions come to mind: > > 1) All the examples appear to use scsi drives; but I assume EIDE are also > usable? IDE seems to be pretty good these days and much cheaper than > scsi. Yes, correct. Note that you shouldn't have more than one disk per controller unless both use tagged queueing. > 2)To what extent can the system be fully mirrored? Without RAID hardware it > seems to me that a conventional disk partition outside the mirrored volume is > probably necessary for mounting / ; is this true? Not completely. Check the latest man pages. 4.8 will be able to handle root file systems on Vinum, though the manner in which it's done is not the same as it is for release 5 and later. > 3)If the regular partition is necessary can this be taken as a modest slice > from one of the disks whose major part is devoted to the mirror volume, > and perhaps the corresponding slice on the other used for swap? Yes, this would be a possibility, but it's not necessary. > 4)If the converse is true that the entire system can reside inside the > mirrored volume then do I need a temporary additional disk to build the > system? In any case it seems that an outside region or separate physical > disk would be better for swap. No, there's a trick there. I'm attaching the relevant text from upcoming fourth edition of "The Complete FreeBSD". This relates to release 5, but the only difference is what you put in /etc/rc.conf and /boot/loader.conf, and that's in the man page. Let me know if anything's confusing. Greg -- When replying to this message, please copy the original recipients. If you don't, I may ignore the reply or reply to the original recipients. For more information, see http://www.lemis.com/questions.html See complete headers for address and phone numbers --nccO0ldXW0cuDU6a Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="vinum.txt" Installing FreeBSD on Vinum ___________________________ Installing FreeBSD on Vinum is complicated by the fact that sysinstall and the loader don't support Vinum, so it is not possible to install directly on a Vinum volume. Instead, you need to install a conventional system and then convert it to Vinum. That's not as difficult as it might sound. A typical disk installation lays out disk partitions in the following manner: da0s3a: / file system da0s3b: swap da0s3e: /usr file da0s3c: entire disk da0s3f: /var file system Figure 12-9: Typical partition layout without Vinum This layout shows three file system partitions and a swap partition, which is not the layout recommended on page 68. We'll look at the reasons for this below. Each partition corresponds logically to a Vinum subdisk. You could enclose all these subdisks in a Vinum drive. The only problem is that Vinum stores its configuration information at the beginning of the drive, and that's where the root file system is. One way to solve this problem is to put the swap partition first and make it 265 sectors longer than needed. You can do this from sysinstall simply by creating the swap partition before any other partition. Consider installing FreeBSD on a 4 GB drive. Create, in sequence, a swap partition of 256 MB, a root file system of 256 MB, a /usr file system of 2 GB, and a /var file system to take up the rest. It's important to create the swap partition at the beginning of the disk, so you create that first. After installation, the output of disklabel looks like this: 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 524288 532480 4.2BSD 2048 16384 94 # (Cyl. 871*- 1729*) b: 532215 265 swap # (Cyl. 0*- 871*) c: 8386733 0 unused 0 0 # (Cyl. 0 - 13726*) e: 4194304 1056768 4.2BSD 2048 16384 89 # (Cyl. 1729*- 8594*) f: 3135661 5251072 4.2BSD 2048 16384 89 # (Cyl. 8594*- 13726*) To convert to Vinum, use disklabel with the -e (edit label) option to create a volume of type vinum that maps the c partition: h: 8386733 0 vinum # (Cyl. 0 - 13726*) After this, you have the following situation: da0s3b: swap da0s3a: / file system da0s3e: /usr file da0s3c: entire dda0s3h: vinum drive da0s3f: /var file system Figure 12-10: Partition layout with Vinum The shaded area at the top of the Vinum partition represents the configuration information, which cuts into the swap partition. To fix that, we redefine the swap partition to start after the Vinum configuration information and to be 265 sectors shorter. The file systems are relatively trivial to recreate: take the size and offset values from the disklabel output above and use them in a Vinum configuration file: drive rootdev device /dev/da0s2h volume swap plex org concat # b: 532215 265 swap sd len 532215s driveoffset 265s drive rootdev volume root plex org concat # a: 524288 532480 4.2BSD 2048 16384 94 sd len 524288s driveoffset 532480s drive rootdev volume usr plex org concat # e: 4194304 1056768 4.2BSD 2048 16384 89 sd len 4194304s driveoffset 1056768s drive rootdev volume var plex org concat # f: 3135661 5251072 4.2BSD 2048 16384 89 sd len 3135661s driveoffset 5251072s drive rootdev The comments are the corresponding lines from the disklabel output. They show the corresponding values for size and offset. Run vinum create against this file, and confirm that you have the volumes /, /usr and /var. Next, ensure that you are set up to start Vinum with the new method. You should have the following lines in /boot/loader.conf: vinum_load="YES" vinum.autostart="YES" Then reboot to single user mode, start Vinum and run fsck against the volumes, using the -n option to tell fsck not to correct any errors it finds. You should see something like this: # fsck -n -t ufs /dev/vinum/usr ** /dev/vinum/usr (NO WRITE) ** Last Mounted on /usr ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups 35323 files, 314115 used, 718036 free (4132 frags, 89238 blocks, 0.4% fragmentation) If there are any errors, they will probably be because you have miscalculated size or offset. You'll see something like this: # fsck -n -t ufs /dev/vinum/usr ** /dev/vinum/usr (NO WRITE) Cannot find file system superblock /dev/vinum/usr: CANNOT FIGURE OUT FILE SYSTEM PARTITION You need to do this in single user mode because the volumes are shadowing file systems, and it's normal for open file systems to fail fsck, since some of the state is in buffer cache. If all is well, remount the root file system read-write: # mount -u / Then edit /etc/fstab to point to the new devices. For this example, /etc/fstab might initially contain: # $Id: fstab,v 1.3 2002/11/14 06:48:16 grog Exp $ # Device Mountpoint FStype Options Dump Pass# /dev/da0s4a / ufs rw 1 1 /dev/da0s4b none swap sw 0 0 /dev/da0s4e /usr ufs rw 1 1 /dev/da0s4f /var ufs rw 1 1 Change it to reflect the Vinum volumes: # $Id: fstab,v 1.3 2002/11/14 06:48:16 grog Exp $ # Device Mountpoint FStype Options Dump Pass# /dev/vinum/swap none swap sw 0 0 /dev/vinum/root / ufs rw 1 1 /dev/vinum/usr /usr ufs rw 1 1 /dev/vinum/var /var ufs rw 1 1 Then reboot again to mount the root file system from /dev/vinum/root. You can also optionally remove all the UFS partitions except the root partition. The loader doesn't know about Vinum, so it must boot from the UFS partition. Once you have reached this stage, you can add additional plexes to the volumes, or you can extend the plexes (and thus the size of the file system) by adding subdisks to the plexes, as discussed on page 229. --nccO0ldXW0cuDU6a-- --fberPwKQctZF/fXp Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (FreeBSD) iD8DBQE+csD8IubykFB6QiMRAroyAJ414Rihf7ED9x1lQXiS6w5aPRJAXACgm961 FqaAYSsWowAK/iN/FN90dWo= =fRcR -----END PGP SIGNATURE----- --fberPwKQctZF/fXp-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message