(Answer) (Category) SCO UnixWare 7/OpenUNIX 8/OpenServer 6 FAQ : (Category) Media/Device Information, Filesystems, and Disks :
How do I create a slice in a partition?
People add a slice if they want to make another filesystem or add additional swap space. Most slices were created the easy way, during ISL or when you added a drive and ran diskadd. If you need more than 13 slices or you just postponed adding them until later, you'll want to do the following:

      1) Choose a drive with an active UnixWare/OpenServer partition with free
         space in it.
      2) Print the VTOC to a temp file called mytoc.
      3) Look at mytoc and determine what slice number to use.
      4) Determine from mytoc where to start your new slice.
      5) Determine using math how many sectors to use... The Magic Multiplier.
      6) Edit and save mytoc with the new slice #, TAG, FLAG, Start, and Size.
      7) Impress mytoc onto the system as the new VTOC. 
      8) Reboot if you changed the root disk drive or if you added a slice
         above number 15.
 
After that is done, the slice is ready for a filesystem and mounting. Here is an in-depth example of the above procedure:
      1) I'll choose the partition that is on my first hard drive
         because it has some free space on it and it has an easy to
         follow example slice (/home).  That means scsi id 0.
2) prtvtoc -f /tmp/mytoc /dev/rdsk/c0b0t0d0s0
3) less /tmp/mytoc The output is shown below. Slice 5 is empty. I'll use 5. #SLICE TAG FLAGS START SIZE 0 0x5 0x201 63 16305912 1 0x2 0x200 1076355 6152895 2 0x3 0x201 642600 433755 3 0x0 0x0 0 0 4 0xb 0x200 7229250 8787555 5 0x0 0x0 0 0 6 0xc 0x201 64260 578340 7 0x1 0x201 63 34 8 0xd 0x201 97 15968 9 0x0 0x0 0 0 10 0x9 0x200 16065 48195 11 0x0 0x0 0 0 12 0x0 0x0 0 0 13 0x0 0x0 0 0 14 0x0 0x0 0 0 15 0xf 0x201 16016805 16065
4) To determine where to start, you need to look and see where the last slice ends because the unallocated space begins at then end of the last slice. A cylinder begins at the end of the last slice. From the above output, I can see slice 0, the whole partition, starts at 63 and is 16305912 sectors long. It is important to realize that:
(start sector) + (number of sectors) = (beginning sector of empty space).
For example, a hypothetical slice that starts at sector 0 and is 10 sectors long. Then:
( 0 ) + ( 10 ) = 10
which means that the slice takes up sectors 0-9, and sector 10 is where the free space starts.
Back to the real chart, we see: (63) + (16305912) = (16305975) which tells me that the drive ends on 16305975. Now I look for the last slice which is the slice with the highest start number, 15 in this case. Below is a listing of slice 15 again:
#SLICE TAG FLAGS START SIZE 15 0xf 0x201 16016805 16065

      I want to start at the beginning of the unallocated space.  
      The formula says:
16016805 + 16065 = 16032870
So the answer to this section is: The START sector = 16032870.
5) How many sectors to use.... The Magic Multiplier. I've determined where to start the slice in part (4), and that sector is on a cylinder boundary. I also want it to end on a cylinder boundary. So I need to determine about how many sectors I have to play with, and then calculate how many I need to make my slice end on a cylinder boundary. I do a quick partsize as described in the question "How do I list the disk geometry like Cylinders, Heads, Bytes/Sector?": #TYPE HEADS CYLS SECS SECSZ 4 255 1115 63 512
So now I am armed with the data that a track is 63 sectors around, and a cylinder is 255 tracks high. That's 255 tracks that are 63 sectors around or (255 x 63)=16065 sectors. That's the Magic Multiplier...: 16065. There are 16065 sectors in a cylinder. The sector size of my new slice needs to be a multiple of 16065. Every START listed in the table is an even multiple of 16065.
By using the Magic Multiplier this way, we assure ourselves that our slices start at the beginning of a cylinder and end at the end of a cylinder.
In this example, I subtract to get the amount of space available: 16305975 Partition ends on this sector. - 16032870 New slice starts on this sect. ------------- = 273105 I have this much unalloc'd space to play with.
Doing a little multiplying I see that, if I try a few multiples of the Magic Multiplier:
14 x 16065 = 224910 15 x 16065 = 240975 16 * 16065 = 257040 17 * 16065 = 273105
I'll the second one. My answer is then: SECZ = 240975


      6) So far I've decided:
TAG = 0x4 from man edvtoc 0x4 means user filesystem FLAG = 0x200 from man edvtoc 0x200 means valid to use SLICE = 5 from Step (3) START = 16032870 from Step (4) SECSZ = 240975 from Step (5)
The edited file looks like this:

                  /tmp/mytoc
        +---------------------------------------------
        |#SLICE    TAG     FLAGS   START    SIZE
        | 0        0x5     0x201   63       16305912
        | 1        0x2     0x200   1076355  6152895
        | 2        0x3     0x201   642600   433755
        | 3        0x0     0x0     0        0
        | 4        0xb     0x200   7229250  8787555
        | 5        0xb     0x200   16032870 240975      
        | 6        0xc     0x201   64260    578340
        | 7        0x1     0x201   63       34
        | 8        0xd     0x201   97       15968
        | 9        0x0     0x0     0        0
        |10        0x9     0x200   16065    48195
        |11        0x0     0x0     0        0
        |12        0x0     0x0     0        0
        |13        0x0     0x0     0        0
        |14        0x0     0x0     0        0
        |15        0xf     0x201   16016805 16065
        |
 

       7)  Now impress this on the drive with 'edvtoc' as in:
edvtoc -f /tmp/mytoc /dev/rdsk/c0b0t0d0s0
We are done. Slice #5 is created as.... /dev/rdsk/c0b0t0d0s5. No need to reboot because the device node for slice 5 exists already.


<mschalit@pacbell.net>
gerberb@zenez.com

[Append to This Answer]
Previous: (Answer) How do I partition a hard drive?
Next: (Answer) How do I create a filesystem in a slice?
This document is: http://www.zenez.com/cgi-bin/ou8faq/faq?file=91
[Search] [Appearance]
This is a Faq-O-Matic 2.721.