2016-08-22

Raw device creation

As raw devices guarantee that write will be completed within transaction (unlike file device even with with DIRECTIO option) and additionally have very good write performance (unlike file with DSYNC option), this is common in production to see raw devices.

To create a raw device you need first to create a device in OS. On Linux station where drive has been attached using IDE controller the disk can be visible via a symbolic file /dev/sdb. First of all partitions should be created on the disk.

To work with partitions execute following steps:

  • start command 
fdisk /dev/sdb


  • optional - press "p" to print all the partitions existing on the disk. Initially the list should be empty
  • optional - press "m" to display all available commands
  • press "n" to create a new partition
  • press "p" to create primary partition (4 primary partitions can be established or 3 primary and 1 extended, allowing creation of a number of logical disks on it)
  • press enter to confirm partition number
  • press enter to confirm starting sector
  • type the size of partition for example in the form of +100MB and press enter
  • repeat process of partition creation as long as desired number of partitions have been created
  • at the end display all the created partitions using "p" command
  • if everything is ok press "w" to write partitions to MBR

For details of  disk partitioning search in Internet or use one of the links:

At that moment partitions have been created and the list of partition's devices can be displayed using:

ls /dev/sdb*

Remember that Sybase ASE needs write permisions on the partition's device file to create a raw device there. Here how to change owner to "sap" account:

chown sap /dev/sdb*

Now process of device creation can be started. From ASE start for example following command:

disk init name='BetaDataDev', physname ='/dev/sdb1', size=48640
disk init name='BetaLogDev', physname ='/dev/sdb2', size=48640

Small remark. On my server parttion of size 100MB was created using fdisk. However when you type the size of the partition in the form of +100MB, fdisk finds the closest cylinder on disk, so that size of created partition will be around 100MB. As you can see on picture below in my case it was 95 MB:


The size of partition /dev/sdb1 is
194560 sectors * 512 (size of sector) =  95 MB

As described in previous posts, when creating a device you should describe the size of raw device passing number of 2KB pages. A simple equation can be used here. You need to multiply number of MB by 512 - this returns the number of 2KB pages that will be assigned to the device. In our case:

95MB * 512 = 48640 pages (2KB each)

That explains the number used in the above init disk command.

No comments:

Post a Comment

SAP Adaprive Server Enterprise

SAP Adaprive Server Enterprise
SAP Adaprive Server Enterprise