Go Vegetarian

Go Vegetarian

Monday, March 23, 2009

swap space on Solaris 10(in Virtual Box)

Can we define space using a zfs pool... Seems not...

I did the exercise but swap -a did not accept to add the files I created with the command mkfile !
It was a little bit trickier that I thought because I was using a Solaris 10 created in Virtual Box.
  • Create a new disk in Virtual Box and assign the disk to you Virtual Machine
  • Boot the Virtual Machine(Solaris) and execute a reboot -- -r
reboot -- -r is necessary to make Solaris see the new disk.
  • use format and fdisk to partition the new disk
-bash-3.00# format
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
2. c1d1
/pci@0,0/pci-ide@1,1/ide@1/cmdk@1,0
Specify disk (enter its number): 2
selecting c1d1
NO Alt slice
No defect list found
[disk formatted, no defect list found]
Warning: Current Disk has mounted partitions.
/dev/dsk/c1d1s0 is currently mounted on /extraswap. 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
show - translate a disk address
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
volname - set 8-character volume name
! - execute , then return
quit
format> pa


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
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
partition> pr
Current partition table (original):
Total disk sectors available: 8372158 + 16384 (reserved sectors)

Part Tag Flag First Sector Size Last Sector
0 usr wm 256 3.99GB 8372158
1 unassigned wm 0 0 0
2 unassigned wm 0 0 0
3 unassigned wm 0 0 0
4 unassigned wm 0 0 0
5 unassigned wm 0 0 0
6 unassigned wm 0 0 0
8 reserved wm 8372159 8.00MB 8388542

partition>
^D
  • use newfs to create the filesystem
-bash-3.00# newfs /dev/dsk/c1d1s0
newfs: construct a new file system /dev/rdsk/c1d1s0: (y/n)? y
Warning: 2370 sector(s) in last cylinder unallocated
/dev/rdsk/c1d1s0: 8371902 sectors in 1363 cylinders of 48 tracks, 128 sectors
4087.8MB in 86 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
7472672, 7571104, 7669536, 7767968, 7866400, 7964832, 8063264, 8161696,
8260128, 8358560
  • mount the filesystem
first create a directory where to mount then mount

-bash-3.00# mkdir extraswap
-bash-3.00# mount -F ufs /dev/dsk/c1d1s0 /extraswap/
  • create the swap space and add it to the system
-bash-3.00# mkfile 1g swap1
-bash-3.00# mkfile 1g swap2
-bash-3.00# mkfile 1g swap3
-bash-3.00# mkfile 900m swap4
-bash-3.00# swap -a /extraswap/swap2
-bash-3.00# swap -a /extraswap/swap2
-bash-3.00# swap -a /extraswap/swap3
-bash-3.00# swap -a /extraswap/swap4
-bash-3.00# swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 181,1 8 1048568 1048568
/extraswap/swap1 - 8 2097144 2097144
/extraswap/swap2 - 8 2097144 2097144
/extraswap/swap3 - 8 2097144 2097144
/extraswap/swap4 - 8 1843192 1843192

That's all !

-Rudy-




No comments: