Wednesday, September 8, 2010

Sun Fire V120 as NAS part 8: Now with UFS filesystem (ZFS to UFS)

Before the summer I did a lot of test with a Sun Fire V120 Sparc server. At the time I used Solaris 10/09 installed in a 37GB disk and a ZFS array of three 18GB disk ia a Storedge S1. The results were bad in terms of network file transfer and I was thinking to reinstall everyrhin with a new UFS configuration.

Thats seems an easy job but The first step was so difficult: Solaris didn't want to changue the ZFS filesystem to UFS. After a lt of searching a I fund the good solution for Sparc Solaris (usually all the information was for x86 Solaris with a different format utility) here. Just a few steps are necessary.

1. We need to use the format utility once with each disc. Here how I re-labeled the first hd (SMI label needed):
# format -e c1t1d0
selecting c1t1d0
[disk formatted]

FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        inquiry    - show vendor, product and revision
        scsi       - independent SCSI mode selects
        cache      - enable, disable or query SCSI disk cache
        volname    - set 8-character volume name
        !     - execute , then return
        quit
format> label
[0] SMI Label
[1] EFI Label
Specify Label type[1]: 0
Auto configuration via format.dat[no]? no
format> quit
#
Now repeat with the next 4 hd's.

2. Partitioning is more complicated.
  • Start the format utility: # format c1t1d0.
  • Select in the menu: partition, an then  modify.
  • Select All free hog:
Select partitioning base:

        0. Current partition table (unnamed)

        1. All Free Hog

Choose base (enter number) [0]? 1

Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       0               0         (0/0/0)           0
  1       swap    wu       0               0         (0/0/0)           0
  2     backup    wu       0 - 7505       16.86GB    (7506/0/0) 35368272
  3 unassigned    wm       0               0         (0/0/0)           0
  4 unassigned    wm       0               0         (0/0/0)           0
  5 unassigned    wm       0               0         (0/0/0)           0
  6        usr    wm       0               0         (0/0/0)           0
  7 unassigned    wm       0               0         (0/0/0)          
  • At this stage we can change the partition sizes (this is a 18GB hd):
Do you wish to continue creating a new partition
table based on above table[yes]?
Free Hog partition[6]? 7
Enter size of partition '0' [0b, 0c, 0.00mb, 0.00gb]: 16gb
Enter size of partition '1' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '3' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '4' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '5' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '6' [0b, 0c, 0.00mb, 0.00gb]:


Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       0 - 7121       16.00GB    (7122/0/0) 33558864
  1       swap    wu       0               0         (0/0/0)           0
  2     backup    wu       0 - 7505       16.86GB    (7506/0/0) 35368272
  3 unassigned    wm       0               0         (0/0/0)           0
  4 unassigned    wm       0               0         (0/0/0)           0
  5 unassigned    wm       0               0         (0/0/0)           0
  6        usr    wm       0               0         (0/0/0)           0
  7 unassigned    wm    7122 - 7505      883.50MB    (384/0/0)   1809408

Okay to make this the current partition table[yes]?
Enter table name (remember quotes): array

Ready to label disk, continue? yes

partition> quit
format> quit
#
3. Now is time to copy the partition table to the other hd's using:
# prtvtoc /dev/rdsk/c1t1d0s2 | fmthard -s - /dev/rdsk/c2t1d0s2
Here I had an small problem because one of the hard disks is different, also 18 GB and Seagate but different model. I had to do all the partitioning one more time but with the same zise partitions.
Total disk cylinders available: 14076 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0 unassigned    wm       0 - 13283       16.00GB    (13284/0/0) 33555384
  1 unassigned    wm       0                0         (0/0/0)            0
  2     backup    wu       0 - 14075       16.95GB    (14076/0/0) 35555976
  3 unassigned    wm       0                0         (0/0/0)            0
  4 unassigned    wm       0                0         (0/0/0)            0
  5 unassigned    wm       0                0         (0/0/0)            0
  6 unassigned    wm       0                0         (0/0/0)            0
  7 unassigned    wm   13284 - 14072      973.15MB    (789/0/0)    1993014
4. This step is easy, copy the metadata:
# metadb -a -f c1t1d0s7 c2t1d0s7 c2t2d0s7 c2t3d0s7
5. And create the Raid 5 array!!!
# metainit d0 -r c1t1d0s0 c2t1d0s0 c2t2d0s0 c2t3d0s0
d0: RAID configurado (RAID is setup)
Now the array is created but is not ready. Using metastat several times we can check the status of the build:
# metastat d0
d0: RAID
    Estado: Inicializando
    Inicialización en progreso:  0.4% terminado
    Entrelazado: 32 bloques
    Tamaño: 100653032 bloques (47 GB)
Dispositivo original:
     Tamaño: 100657536 bloques (47 GB)
        Dispositivo   Bloque de in Base        Estado Reubi  Repuesto en marcha
        c1t1d0s0          5042        No Inicializand    Sí
        c2t1d0s0          5042        No Inicializand    Sí
        c2t2d0s0          2856        No Inicializand    Sí
        c2t3d0s0          5042        No Inicializand    Sí

Device Relocation Information:
Device   Reloc  Device ID
c1t1d0   Sí     id1,sd@SFUJITSU_MAN3184M_SUN18G_02Z33997____
c2t1d0   Sí     id1,sd@SFUJITSU_MAN3184M_SUN18G_02Z35960____
c2t2d0   Sí     id1,sd@SSGI_____ST318404LC______3BT2FCQL0000V121048Z
c2t3d0   Sí     id1,sd@SFUJITSU_MAN3184M_SUN18G_02Z35919____

6. Finished!!!
# metastat d0
d0: RAID
    Estado: Correcto
    Entrelazado: 32 bloques
    Tamaño: 100653032 bloques (47 GB)
Dispositivo original:
     Tamaño: 100657536 bloques (47 GB)
        Dispositivo   Bloque de in Base        Estado Reubi  Repuesto en marcha
        c1t1d0s0          5042        No     Correcto    Sí
        c2t1d0s0          5042        No     Correcto    Sí
        c2t2d0s0          2856        No     Correcto    Sí
        c2t3d0s0          5042        No     Correcto    Sí

Device Relocation Information:
Device   Reloc  Device ID
c1t1d0   Sí     id1,sd@SFUJITSU_MAN3184M_SUN18G_02Z33997____
c2t1d0   Sí     id1,sd@SFUJITSU_MAN3184M_SUN18G_02Z35960____
c2t2d0   Sí     id1,sd@SSGI_____ST318404LC______3BT2FCQL0000V121048Z
c2t3d0   Sí     id1,sd@SFUJITSU_MAN3184M_SUN18G_02Z35919____

7. When the array is finished we can create the filesystem (and wait a lot more time):
# newfs -i 8192 /dev/md/rdsk/d0
newfs: construir un nuevo sistema de archivos /dev/md/rdsk/d0: (y/n)? y
 
Advertencia: 4120 sector(es) en el último cilindro sin asignar
/dev/md/rdsk/d0:        100653032 sectores en 16383 cilindros de 48 pistas, 128 sectores
        49147,0MB en 1024 grupos de cilindros (16 c/g, 48,00MB/g, 5824 i/g)
copias de seguridad super-bloque (para fsck -F ufs -o b=#) en:
 32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
Inicializando grupos de cilindros:
....................
copias de seguridad del superbloque de los últimos 10 grupos de cilindros en:
 99687200, 99785632, 99884064, 99982496, 100080928, 100179360, 100277792, 100376224, 100474656, 100573088
Sorry, I installed Solaris in Spanish but....

9. Now we can mount the filesystem in a directory and it will be ready for use. The same name as my first atempt with ZFS:
# mkdir /fsshared
# mount -F ufs /dev/md/dsk/d0 /fsshared

10. The final step is to make the mount persistent.we need to insert a new line in the /etc/vfstab (data separated with tabs)
/etc/vfstab
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/c1t0d0s1       -       -       swap    -       no      -
/dev/dsk/c1t0d0s0       /dev/rdsk/c1t0d0s0      /       ufs     1       no
-
/dev/dsk/c1t0d0s7       /dev/rdsk/c1t0d0s7      /export/home    ufs     2
yes     -
/devices        -       /devices        devfs   -       no      -
sharefs -       /etc/dfs/sharetab       sharefs -       no      -
ctfs    -       /system/contract        ctfs    -       no      -
objfs   -       /system/object  objfs   -       no      -
/dev/md/dsk/d0  /dev/md/rdsk/d0 /fsshared       ufs     2       yes     -
swap    -       /tmp    tmpfs   -       yes     -

No comments: