Create New Partition Slice | Backup the Partition Table In Unix

After Adding the New Disk To detect Unix OS Refer Following Method.
How To ADD New Device
1)METHOD 1
a)init 0
b)ok Prompt type setenv auto-boot? False
c)Power Off Workstation
d)Install New Disk
e)Power On Workstation
f)Ok Prompt type setenv auto-boot? True
g)boot -r
2)METHOD 2
a)touch /reconfigure
b)reboot
3)METHOD 3
a)devfsadm -c device_class
Fore Example Hard  Disk 
#devfsadm -c disk
Method 3 Is Simple and Best Method To ADD New Device.

Create the Partition Slice In Unix Operating System.
Using Format Disk Utility we can create the table in Unix Operating System
-bash-3.00# format  [ it will show the List of disk ]
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c0d0
          /pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0
       1. c0d1
          /pci@0,0/pci-ide@1,1/ide@0/cmdk@1,0
Specify disk (enter its number):2   [ Choose the Disk ]
format> part
WARNING - This disk may be in use by an application that has
          modified the fdisk table. Ensure that this disk isS
          not currently in use before proceeding to use fdisk.
format> fdisk  [ Prepare Disk For Creating The Partition ]
No fdisk table exists. The default partition for the disk is:
  a 100% "SOLARIS System" partition
Type "y" to accept the default partition,  otherwise type "n" to edit the
 partition table.

format> part [ Used For create the Partition ]
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
        ! - execute , then return
        quit
Oracle Solaris  we can create the 7 Slice.
In the second partition it show the whole Hard disk size
partition> print
Current partition table (original):
Total disk cylinders available: 4092 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)           0
  1 unassigned    wm       0               0         (0/0/0)           0
  2     backup    wu       0 - 4091        7.99GB    (4092/0/0) 16760832
  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       0               0         (0/0/0)           0
  8       boot    wu       0 -    0        2.00MB    (1/0/0)        4096
  9 alternates    wm       1 -    2        4.00MB    (2/0/0)        8192
partition> [Create the Partition 0 ]
Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)           0
Enter partition id tag[unassigned]: 
Enter partition permission flags[wm]: 
Enter new starting cyl[0]: 
Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]: 3g

After create the all the slice print the Partition using print (or) pr command
partition> pr   [Print the Partition Table]
Current partition table (unnamed):
Total disk cylinders available: 4092 + 2 (reserved cylinders) 

Part      Tag    Flag     Cylinders        Size            Blocks

  0 unassigned    wm       0 - 1535        3.00GB    (1536/0/0)  6291456

  1 unassigned    wm       0 -  255      512.00MB    (256/0/0)   1048576

  2     backup    wu       0 - 4091        7.99GB    (4092/0/0) 16760832

  3 unassigned    wm       0 -  255      512.00MB    (256/0/0)   1048576

  4 unassigned    wm       0               0         (0/0/0)           0

  5 unassigned    wm       0 -  255      512.00MB    (256/0/0)   1048576

  6 unassigned    wm       0 -  255      512.00MB    (256/0/0)   1048576

  7 unassigned    wm       0 -  255      512.00MB    (256/0/0)   1048576

  8       boot    wu       0 -    0        2.00MB    (1/0/0)        4096

  9 alternates    wm       1 -    2        4.00MB    (2/0/0)        8192
Finally save the table using name command.
partition> name  [Create the Table name for Partition]
Enter table name (remember quotes): Partition-table- name
Finally write the table using label command
partition> label - [ Save the Partition To Disk ].

How To Backup The Hard Disk Partition Table - Import To New Hard Disk
prtvtoc - Print the Volume of Table content
fmthard - Update the Vtoc(Volume Table of Content).
a)prtvtoc /dev/rdsk/c3d0t0s2 > /tmp/c3t0d0.vtoc
b)fmthard -s /tmp/c3t0d0.vtoc /dev/rdsk/c4d1tos2

We can import the hard disk Directly in single Hard Disk
a)prtvtoc /dev/rdsk/cxtxdxs2 | fmthard -s - /dev/rdsk/cxtxdxs2 

Note - For backup and Restore we have to Mention the Slice 2


Error Message :
-bash-3.00# fmthard -s /tmp/c0d1s2.vtoc /dev/rdsk/c1d1s2
fmthard: Partition 2 specifies the full disk and is not equal
full size of disk.  The full disk capacity is 16760832 sectors.
fmthard: Partition 2 specified as 16764928 sectors starting at 0
        does not fit. The full disk contains 16760832 sectors.
fmthard:  New volume table of contents now in place

While Update the vtoc if we get any error message even though both Hard Disk are the same disk space. To Resolve that issue. Just create the one partition In the new disk. then try it, it will work perfectly.

Related post