Tuesday, September 11, 2012

Solaris: Create new swap partition

Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <DEFAULT cyl 8921 alt 2 hd 255 sec 63>
          /pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@0,0
       1. c0t1d0 <DEFAULT cyl 8921 alt 2 hd 255 sec 63>
          /pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@1,0
Specify disk (enter its number): 1
selecting c0t1d0
[disk formatted]
Warning: Current Disk has mounted partitions.
/dev/dsk/c0t1d0s0 is currently mounted on /var/sadm. Please see umount(1M).
/dev/dsk/c0t1d0s4 is currently mounted on /var/opt/SUNWuce. Please see umount(1M).
/dev/dsk/c0t1d0s5 is currently mounted on /opt/backup. 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
        fdisk      - run the fdisk program
        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> p
Current partition table (original):
Total disk cylinders available: 8921 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders        Size            Blocks
  0        var    wm    1177 - 2482       10.00GB    (1306/0/0)  20980890
  1 unassigned    wu    2483 - 2613        1.00GB    (131/0/0)    2104515
  2     backup    wm       0 - 8920       68.34GB    (8921/0/0) 143315865
  3       swap    wu    2614 - 3136        4.01GB    (523/0/0)    8401995
  4   reserved    wm       1 -  653        5.00GB    (653/0/0)   10490445
  5   reserved    wm     654 - 1176        4.01GB    (523/0/0)    8401995
  6 unassigned    wm       0               0         (0/0/0)            0
  7 unassigned    wm       0               0         (0/0/0)            0
  8       boot    wu       0 -    0        7.84MB    (1/0/0)        16065
  9 unassigned    wm       0               0         (0/0/0)            0

partition> 3  
Part      Tag    Flag     Cylinders        Size            Blocks
  3 unassigned    wm       0               0         (0/0/0)            0
Enter partition id tag[unassigned]: swap
Enter partition permission flags[wm]: wu
Enter new starting cyl[1]: 2614
Enter partition size[0b, 0c, 2614e, 0.00mb, 0.00gb]: 4gb
partition> p
Current partition table (unnamed):
Total disk cylinders available: 8921 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders        Size            Blocks
  0        var    wm    1177 - 2482       10.00GB    (1306/0/0)  20980890
  1 unassigned    wu    2483 - 2613        1.00GB    (131/0/0)    2104515
  2     backup    wm       0 - 8920       68.34GB    (8921/0/0) 143315865
  3       swap    wu    2614 - 3136        4.01GB    (523/0/0)    8401995
  4   reserved    wm       1 -  653        5.00GB    (653/0/0)   10490445
  5   reserved    wm     654 - 1176        4.01GB    (523/0/0)    8401995
  6 unassigned    wm       0               0         (0/0/0)            0
  7 unassigned    wm       0               0         (0/0/0)            0
  8       boot    wu       0 -    0        7.84MB    (1/0/0)        16065
  9 unassigned    wm       0               0         (0/0/0)            0
partition> h
Expecting one of the following: (abbreviations ok):
        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> label
Ready to label disk, continue? y
partition> p
Current partition table (unnamed):
Total disk cylinders available: 8921 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders        Size            Blocks
  0        var    wm    1177 - 2482       10.00GB    (1306/0/0)  20980890
  1 unassigned    wu    2483 - 2613        1.00GB    (131/0/0)    2104515
  2     backup    wm       0 - 8920       68.34GB    (8921/0/0) 143315865
  3       swap    wu    2614 - 3136        4.01GB    (523/0/0)    8401995
  4   reserved    wm       1 -  653        5.00GB    (653/0/0)   10490445
  5   reserved    wm     654 - 1176        4.01GB    (523/0/0)    8401995
  6 unassigned    wm       0               0         (0/0/0)            0
  7 unassigned    wm       0               0         (0/0/0)            0
  8       boot    wu       0 -    0        7.84MB    (1/0/0)        16065
  9 unassigned    wm       0               0         (0/0/0)            0

List Swap Space:
# swap -l
swapfile             dev    swaplo   blocks     free
/dev/dsk/c6t0d0s1   79,1         8  1048568  1048568

Turn off swap:
# swap -d /dev/dsk/c6t0d0s1
/dev/dsk/c6t0d0s1 was dump device --
invoking dumpadm(1M) -d swap to select new dump device
dumpadm: no swap devices are available

Notice you have no dump device
Disable swap from coming back on reboot:
#vi /etc/vfstab
there's a line to mount the swap space, remove it.. Look for your swap device, i.e. c6t0d0s1.

Add swap space (partition):
#swap -a /dev/desk/c6t0d0s1

Adding file based swap space:
#mkfile 250m /opt/myswapfile
#swap -a /opt/myswapfile

No comments:

Post a Comment