Date: Wed, 23 Jul 1997 23:21:48 -0700 (PDT) From: Simon Shapiro <Shimon@i-Connect.Net> To: "Greg K. Cagle" <greg@lightningweb.com> Cc: freebsd-scsi@FreeBSD.ORG, freebsd-fs@FreeBSD.ORG Subject: RE: adding RAID to the OS without re-partitioning Message-ID: <XFMail.970723232148.Shimon@i-Connect.Net> In-Reply-To: <Pine.BSF.3.95q.970723055054.25156A-100000@nefertiti.lightningweb.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi "Greg K. Cagle"; On 23-Jul-97 you wrote: > I plan on adding a RAID disk array to my existing server. Ther server > has > three HDD's in it now, with "/" as one, "/usr/" as another, and a spare > that's partitioned as "/scratch/". > > The disk array will be an independent unit, and will hook up to the > external port on my Adaptec 2940UW. The company (Baydel) says that the > array will appear as one large volume to FreeBSD. > > My question: How do I include the new array as part of the filesystem, > without re-installing? I know I can make those choices when I first > install the OS, but can I add a partition now, without messing up > anything? I want to end up with the large RAID as my "/usr/" partition. > > Thanks for suggestions, > > Greg > > ps I have 2.1.5 on a Pentium Pro 200 with 128MB ram. Since no on else took it on, I will donate my $0.02. This is really not a SCSI issue at all. essentially, this is what you do: First, find out the name and size of the disk. Right after booting, do: dmesg | grep '^sd[0-9]' This will give you some output like: sd17(dpt0:1:0): Direct-Access 16394MB (32542592 528 byte sectors) You want to remember two things from the above example: 1. The disk is sd17 2. The reported size is 32,542,592 sectors. If you see (on a DPT): sd17: Forcing sector size to 512 Ignore that. It simply tells you that the disks have a physical size of 528 bytes. We use that to record ECC data. This insures that data transfers on the SCSI bus (cable) are ECC corrected. That's all. Next, create a file with this format: # This is the Sendero/Nomis SCSI RAID-5 array # It is composed of five 4GB Baracudas. # Reported capacity is 16,394MB (32,542,592x528) # Aligned to 1Mb ``cylinders'' it yields 32,540,672x512 blocks # or 15,889 ``cylinders'' # # Do not adjust partitions!!! g c15889 h64 s32 p 1 165 64 8388544 p 2 165 8388608 8388608 p 3 165 16777216 8388608 p 4 165 25165824 7374848 Adjust the cXXXX field in the geometry record to match capacity of the device (I take the number of sectors and mod 2048 itto arrive at the number of 1MB ``cylinders'' we have. It costs few megbytes of space but is so much easier to handle. The next step is to edit /etc/disktab and create an entry for each of these partitions. The terminology is confusing. What we have done so far is plan on which ``partitions'' will fdisk create. From this point forward, these partitions are actually called ``slices''. Also notice that until recently fdisk partitions (slices) were numbered 0-3, while disklabel slices are 1-4. Recently, at least this part is uniform; fdisk partitions are 1-4 and dislabel slices (same thing!) are also 1-4. Below is a typical /etc/disktab, for the LAST partition-slice (4) in the above RAID array: sd17.s4|sendero-5.s4|DPT Raid-5 composed of five 4GB Baracudas:\ :ty=simulated:\ :ns#2048:\ :nt#1:\ :nc#3601: \ <--- number of ``cylinders'' :sc#2048: \ :su#7374848:\ <---- su = nc * sc :se#512:\ :rm#7200:\ :pc#7374848:oc#0:tc=unused:bc#4096:fc#512: \ <-- the whole device :pa#2097088:oa#64:ta=4.2BSD:ba#4096:fa#512: \ <-- Partition a :pb#5277696:ob#2097152:tb=4.2BSD:bb#4096:fb#512: <-- partition b You can have partitions a,b,d,e,f,g,h. In theory you can have c as a partition but certain utilities ``know'' that c is hte whoile disk. Some things in FreeBSD also ``know'' that ``b'' is a swap device. Oh, when we say ``partition'' here, we mean FreeBSD partition WITHIN the fdisk partition, or more correctly (in this context); A device contains several fdisk slices, each contains several FreeBSD partitions. Enough ``theory''. go make the necessary nodes: cd /dev ./MAKEDEV sd17 ./MAKEDEV sd17s1a The above two created all the necessary entried for all the partitions, slices, and what-have-you. Now do: fdisk -i -f my_own_fdisk_file sd17 Now Listen Carefully: * MAKE SURE, ABSOLUTELY SURE you have dumped fdisk of your boot disk to a safe file, in the format indicated above. * MAKE SURE, ABSOLUTELY SURE you have the entries for (in our example) sd17 in /dev/ * TYPE the fdisk command EXACTLY as indicated above. Do NOT MISS an argument! If you do not, and I still miss sometimes, fdisk will write the new configuration, or some version of it ON YOUR BOOT DRIVE!!! It will do so with glee, quielty, without warning (sorry, it will put on the screen something like ``******* working on /dev/sd0 ****'' which you will MISS as you are so unsure and nervous about wiping your system out. If you saw that, you just did. If you did, don't panic! and DO NOT, I repeat, DO NOT reboot or shutdown your system! Just follow this procedure, to re-create the boot disk partitions-slices. Or back it up. you did back it up BEFORE starting this procedure. Right? Right... but did you actually read that tape? If all is well, fdisk will create the partitions and complain about the disk labels. This is OK. There are no labels yet, so why should they be correct? Once this is done, do the following: disklabel -w -r sd17s4 sd17.s4 "short/meaningful label" This will create /dev/sd17s4a and /dev/sd17s4b. As you run disklabel, it will complain about the label for this partition and for all the slices too. The reason is that when FreeBSD opens ANY raw device, it reads the fdisk data for the disk and all the labels for all the slices. Since you are just creating them, there will be complaints. just run each disklabel command twice and the complaint will disappear for that slice. After you created/labeled three slices, it will not complain about the fourth. If you want file systems there do: newfs /dev/rsd17s4a newfs /dev/rsd17s4b You can embelish, tune and improve how newfs makes the file system. You can change things with tunefs (or some such). I am not the person to ask about that. I use newfs as is. The last steps are just as easy. Say you have already /var/spool/news and you want to move it from /var to this new array, splitting it between two filesystems. Last time I installed news I had /var/spool/news/alt/binaries on a separate filesystem. Let's use that as an example. Edit /etc/fstab and add two new lines. Emulate what is already there, just replace the first two fields. Shutdown the news server. mount /dev/sd17s4a /mnt mkdir -p /mnt/alt/binaries chown news.news /mnt /mnt/alt/binaries mount /dev/sd17s4b /mnt/alt/binaries chown news.news /mnt/alt/binaries # Trust me on this one :-) cd /var/spool/news find . | cpio -dmpv /mnt sync umount /mnt/alt/binaries umount /mnt rm -rf /var/spool/news/* mount /var/spool/news mount /var/spool/news/alt/binaries Simple. Isn't it? And they said Unix is not better than NT. simon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.970723232148.Shimon>