disk init

Description

Makes a physical device or file usable by Adaptive Server.

Syntax

disk init 
	name = "device_name", 
	physname = { 'physical_name' | 'cache_name'} 
	skip_alloc={true | false}, 
	[vdevno = virtual_device_number,]
	size = number_of_blocks 
	[, type = 'inmemory' ]
	[, vstart = virtual_address 
		, cntrltype = controller_number] 
		[, dsync = {true | false}]
	[, directio = {true | false}]
	[, instance = "instance_name"]

Parameters

device_name

is the name of the database device or file. The name must conform to the rules for identifiers and must be enclosed in single or double quotes. This name is used in the create database and alter database commands.

physical_name

is the full specification of the database device or cache. This name must be enclosed in single or double quotes. When the physical device path is relative, disk init returns a warning.

cache_name

name of the cache on which you are creating the disk.

inmemory

indicates you are creating an in-memory device.

skip_alloc

is a Boolean parameter for the disk init command. It is supported for devices created on non-Windows file systems and on Windows raw systems. When skip_alloc is set to true, users can avoid initialization of pages with zeros. The default of skip_alloc is false.

vdevno

is the virtual device number, which must be unique among the database devices associated with Adaptive Server. The device number 0 is reserved for the master device. Otherwise, valid device numbers must be between 1 and 2,147,483,647.

To determine the virtual device number, look at the device_number column of the sp_helpdevice report, and use the next unused integer.

size

is the amount of space to allocate to the new device. The following are example unit specifiers, using uppercase, lowercase, and single and double quotes interchangeably: ‘k’ or “K” (kilobytes), “m” or ‘M’ (megabytes), “g” or “G” (gigabytes), and ‘t’ or ‘T’ (terabytes). Sybase recommends that you always include a unit specifier. Quotes are optional if you do not include a unit specifier. However, you must use quotes if you include a unit specifier. Acceptable values are:

  • 5120 = 10MB

  • "5120" = 10MB

  • "10M" = 10MB

vstart

is the starting virtual address, or the offset, for Adaptive Server to begin using the database device. The following are example unit specifiers, using uppercase, lowercase, and single and double quotes interchangeably: ‘k’ or “K” (kilobytes), “m” or ‘M’ (megabytes), “g” or “G” (gigabytes), and ‘t’ or ‘T’ (terabytes). Sybase recommends that you always include a unit specifier. Quotes are optional if you do not include a unit specifier. However, you must use quotes if you include a unit specifier.

The size of the offset depends on how you enter the value for vstart.

  • If you do not specify a unit size, vstart uses 2K pages for its starting address. For example, if you specify vstart = 13, Adaptive Server uses 13 * 2K pages as the offset for the starting address.

  • If you specify a unit value, vstart uses the unit value as the starting address. For example, if you specify vstart = "13M", Adaptive Server sets the starting address offset at 13MB.

The default value (and usually the preferred value) of vstart is 0. If the specified device does not have the sum of vstart + size blocks available, the disk init command fails. If you are running the Logical Volume Manager on an AIX operating system, vstart should be 2. Specify vstart only if instructed to do so by Sybase Technical Support.

cntrltype

specifies the disk controller. Its default value is 0. Reset cntrltype only if instructed to do so by Sybase Technical Support.

dsync

specifies whether writes to the database device are flushed to the storage media, or are buffered only when using operating system files. This option is meaningful only when you are initializing an operating system file; it has no effect when initializing devices on a raw partition. By default, all operating system files are initialized with dsync set to true.

directio

allows you to configure Adaptive Server to transfer data directly to disk, bypassing the operating system buffer cache. directio is a static parameter that requires a restart of Adaptive Server to take effect.

By default, directio is set to false for nonclustered Adaptive Servers, and to true for clustered Adaptive Servers.

The directio parameter is ignored for raw devices.

instance = "instance_name"

(clusters only) specifies the device as private and sets its owning instance to instance_name.

Examples

Example 1

Does not initialize pages with zeros:

disk init name="d2", physname="/usr/sybase/devices/d3.dat", skip_alloc="true",
size="10G"

Adaptive Server does not allocate space during disk initialization if skip_alloc is set to true.

Example 2

Initializes 10MB of a disk on a UNIX system:

disk init 
name = "user_disk", 
physname = "/dev/rxy1a", 
vdevno = 2, size = 5120 

Example 3

Initializes 10MB of a disk on a UNIX operating system file. Adaptive Server opens the device file with the dsync setting, and writes to the file are guaranteed to take place directly on the storage media:

disk init 
name = "user_file", 
physname = "/usr/u/sybase/data/userfile1.dat", 
vdevno = 2, size = 5120, dsync = true

Example 4

Creates a device named “user_disk” that uses directio to write data directly to disk:

disk init 
name = "user_disk", 
physname = "/usr/u/sybase/data/userfile1.dat", 
size = 5120, 
directio= true

Example 5

creates a device named inmemory_dev:

disk init name = inmemory_dev,
physname = 'imdb_cache',
size = '3G',
type = 'inmemory'

Usage


Using dsync

NoteDo not set dsync to false for any device that stores critical data. The only exception is tempdb, which can safely be stored on devices for which dsync is set to false.


Creating devices for in-memory and relaxed durability databases

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

The permission checks for disk init differ based on your granular permissions settings. You must be using the master database to use disk init.

Granular permissions enabled

With granular permissions enabled, you must be a user with manage disk privilege.

Granular permissions disabled

With granular permissions disabled, you must be a user with sa_role.

disk init permission is not transferable.

Auditing

Values in event and extrainfo columns of sysaudits are:

Event

Audit option

Command or access audited

Information in extrainfo

20

disk

disk init

  • Roles – current active roles

  • Keywords or optionsdisk init

  • Previous value – NULL

  • Current value – NULL

  • Other information – name of the disk

  • Proxy information – original login name, if set proxy is in effect

See also

Commands alter database, create database, disk refit, disk reinit, dump database, dump transaction, load database, load transaction

System procedures sp_diskdefault, sp_dropdevice, sp_helpdevice, sp_logdevice