Duplicar tabla de particiones Solaris de un disco a otro idéntico

Introducción

Cuando se tienen dos discos iguales y se desea en un futuro espejar (con Solaris Volume Manager, por ejemplo) es necesario hacer que ambos discos tengan la misma tabla de slices. La siguiente captura muestra cómo lo hemos hecho, para capturar la tabla del disco 0 y copiarla en el disco 1.

Captura

En la primera parte, usando el comando format, capturaremos en el fichero /tmp/format0.dat las particiones del disco 0.

# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
          /pci@780/pci@0/pci@9/scsi@0/sd@0,0
       1. c0t1d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
          /pci@780/pci@0/pci@9/scsi@0/sd@1,0
Specify disk (enter its number): 0
selecting c0t0d0
[disk formatted]
Warning: Current Disk has mounted partitions.
/dev/dsk/c0t0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c0t0d0s1 is currently used by swap. Please see swap(1M).
/dev/dsk/c0t0d0s3 is currently mounted on /var. Please see umount(1M).
/dev/dsk/c0t0d0s4 is part of active ZFS pool export. Please see zpool(1M).
/dev/dsk/c0t0d0s6 is currently mounted on /usr/local. Please see umount(1M).


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
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> p


PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> name
Enter table name (remember quotes): disco0

partition> q


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
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> save
Saving new disk and partition definitions
Enter file name["./format.dat"]: /tmp/format0.dat

Ahora, podemos usar esos datos para ponerlos en el disco 1:

# format -x /tmp/format0.dat
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
          /pci@780/pci@0/pci@9/scsi@0/sd@0,0
       1. c0t1d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
          /pci@780/pci@0/pci@9/scsi@0/sd@1,0
Specify disk (enter its number): 1
selecting c0t1d0
[disk formatted]
/dev/dsk/c0t1d0s4 is part of active ZFS pool export. Please see zpool(1M).


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
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> p   


PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> select
        0. disco0
Specify table (enter its number)[0]: 0

partition> p
Current partition table (disco0):
Total disk cylinders available: 14087 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm    1611 -  2617        4.89GB    (1007/0/0)   10247232
  1       swap    wu       0 -  1610        7.82GB    (1611/0/0)   16393536
  2     backup    wm       0 - 14086       68.35GB    (14087/0/0) 143349312
  3        var    wm    2618 -  3624        4.89GB    (1007/0/0)   10247232
  4 unassigned    wm    4632 - 14085       45.87GB    (9454/0/0)   96203904
  5 unassigned    wm       0                0         (0/0/0)             0
  6        usr    wm    3625 -  4631        4.89GB    (1007/0/0)   10247232
  7 unassigned    wm       0                0         (0/0/0)             0

partition>  label
Ready to label disk, continue? y

partition> ^D

Administradores/T200/DuplicarTablaParticiones (last edited 2008-12-04 08:48:53 by localhost)