天天看点

solaris-Disk management

### Disk management###

disks consist of the following:

1.tracks -concentric rings on each

platter

2.cylinders -groups of tracks

3.sectors/blocks -512 byte blocks

###Disk partitions###

Note: partitions within solaris are AKA

slices

Note: X86 PCs are limited to 4 Fdisk

primary partitions

Note: solaris requires 1 Fdisk partition

for its use

Disk0 -36G

  -1-Fdisk partition for solaris's use

   -slices are created within the single

Fdisk partition

Disk1 -36G

  -1-Fdisk partition for solaris's use

   -Slices

Note: solaris uses a volume table of

contens(VTOC) to represent variouse

slices within the lone Fdisk partition on

the disk

Note: On sparc,solaris uses VTOC to

represent All slices on disk,Not within

lone Fdisk partition

slice rules within x86 using VTOC:

10 slices(0-9) MAX maybe created when

using VTOC on x86 slice 2 -VTOC

Note: VTOC represents the disk's label

and occupies slice 2

0,1,2,3,4,5,6,7 -7 slices are available

for user use

default slice allocation:

0 - / (root) mount point

3 - /var

7 - /export/home

sparc disk layout -Max of 8 slices -0-7

disk0 - 36G

 -1-Fdisk partition for solaris' use

  -slices are created within the single

  -0 - /

  -3 - /var

  -7 - /export/home

Note:Disk with '/ (root) & /usr' mount

points is known as the 'system disk' -

this disk is used to boot solaris.

All other disks attached to the system

are known as secondary disks

###Print VTOC/Disk Label -using

prtvtoc###

prtvtoc /dev/dsk/c0t0d0s0

/dev/dsk/c0t0d0s0 -Nomenclature

c0t0d0s0:

c0 -controller# -this is the first

controller on the system

t0 -is an identifier for bus-oriented

controller -first target or id on the bus

-first hard disk

d0 -represents disk #

s0 -represents the slice/partition#

### Our server's Disks###

controller 0:

  -disk0 -/dev/dsk/c0t0d0s0 -system disk

   -fdisk partition

    -slices(0,1,2,3,7,8)

   -disk1 - /dev/dsk/c0t0d0s0 -secondary

disk

   -disk2 - /dev/dsk/c0t0d0s0 -secondary

###Format utilility###

add, list, format, repair, partition

(slice) disks

format -dumps connected controllers and

disks

format /dev/dsk/c0*

Note: Solaris requires the presence of 1

Fdisk partition/per disk on X86 systems

to be able to create slices/partitions.

DISK2 -36G

  -Fdisk partition #1 Windows 2003 -10GB

  _Fdisk partition #2 Linux -10G

  -Fdisk partition #3 Solaris -16G

DISK 1 -36G

   -Fdisk partition #1

   -Free space -SOLARIS

Partition/slices permissions:

wm -writable & mountable

wu -writable & unmountable

rm -read only & mountable

Cylinders 598 - 4423

usable =0 - 5

/data1 - /dev/dsk/c0t0d0s4

secondary disks:

/data2 - /dev/dsk/c0t1d0s0

/data3 - /dev/dsk/c0t2d0s0

###create Unix File System (UFS) for new

slices###

newfs /dev/rdsk/c0t0d0s4

newfs /dev/rdsk/c0t1d0s0

/dev/rdsk/c0t2d0s0

Note: create file systems by referring to

the raw location /dev/rdsk/*

###create mount points for newly-created

file systems###

/data1

/data2

/data3

mkdir /data1 /data2 /data3

test mounting all newly-created file

systems at mount points

mount /dev/dsk/c0t0d0s4 /data1 -3GB

mount /dev/dsk/c0t1d0s0 /data2 -20GB

mount /dev/dsk/c0t2d0s0 /data3 -30G

### populate /etc/vfstab file for

automatic mount @ system boot ###

### steps to partition and create file

systems###

1. run 'format' to identify connected

disks

2. for x86, ensure the presence of fdisk

partition

3. create desired slices using'

partition' sub-menu of format

4.label

eah disk after altering partition table

5. use 'newfs' with raw location to

create UFS file system for each slice

6.mount each UFS slice to user-space

directory

7.update /etc/vfstab file to allow

changes to persist

###recap of steps necessary to

partition/slice&create file systems###

steps:

 1. unmount existing file systems

     -umount /data2 /data3

 2. confirm fdisk partitions via 'format'

utility

     -format -select disk -select fdisk

 3. use modify to create slices on

desired drives

   Disk1

    -slice 0 - /dev/dsk/c0t1d0s0 -30GB

   Disk2

    -slice 0 - /dev/dsk/c0t2d0s0 -30 GB

 4. create file systems using 'newfs

/dev/rdsk/c0t0d0s0'

 5. use 'fsck /dev/rdsk/c0t1d0s0' to

vertify the consistency of the file

system

 6. mount file systems at various mount

points

    mount /dev/dsk/c0t1d0s0 /data2 &&

mount /dev/dsk/c0t2d0s0 /data3

 7. create entries in virtual file system

table (/etc/vsftab) file

### How to determine file system

associate with device### 

 1. fstyp /dev/dsk/c0t0d0s0 -returns file

system type

 2. grep mount point from /etc/vfstab

    grep /var /etc/vfstab

 3. cat /etc/mnttab -displays currently

mounted file system

###temporary file system(TEMPFS)

implementation###

TempFS provides in-memory(RAM),very fast,

storage and boosts application

performance

 1.determine avaialble memory and the

amount you can spare for TEMPFS -prtconf

 -allocate 100MB

 2. excute mount command:

mkdir /tempdata && chmod 777

/tempdata&&mount -F tmpfs -osize=100m

swap tempdata

Note: TEMPFS data does Not persis/survive

across reboots

Note: TEMPFS data is lost when the

following occurs:

1. TEMPFS mount point is unmounted:i.e

umount /tempdata

2. system reboot

Modify /etc/vfstab to include the TEMPFS

mount point for reboots

swap - /tempdata tmpfs -yes

###Swap creation -Files & Partitions###

Note: it's easier to create a swap file

on an exsisting UFS file system on

running solaris instance than it is to

create a swap partition on an already

mounted disk

Vitual swap space -all swap areas

(partition&files) + free physical memory

swap -l -lists available swap devices

and/or swap files

/dev/dsk/c0t0d0s1 -default swap partition

during installation

swap -s -lists swap space,including

physical memory in 1024 byte increments

###swap file/partition creation###

swap -l | -s -to display swap information

mkfile size location_of_file -to create

swap file

mkfie 512m /data2/swap2 -create swap file

swap -a -activates the swap file

swap -a /data2/swap2 -activates swap file

to remove swap file:

swap -d /data2/swap2 -removes swap sapce

from kernel. does Not remove file

rm -rf /data2/swap2

###swap partition creation###

format -select disk -partition -select

slice/modify

swap -a /dev/dsk/c0t2d0s1

modify /etc/vfstab

继续阅读