Create and List Backstores….

Create a block backstore

The following commands create block backstores. Use the cd command to change to the /backstore/block directory.

/> cd /backstore/block

/backstore/block

Use the create command to create two block storage objects.

/backstores/block> create name=LUN_1 dev=/dev/xvdd

/backstores/block> create name=LUN_2 dev=/dev/xvde

Create a fileio backstore

The following commands create a fileio backstore. From the targetcli shell, use the cd command to change to the /fileio directory.

/> cd /backstore/fileio

/backstore/fileio

Use the create command to create a fileio storage object.

/backstores/fileio> create LUN_3 /root/disk1.img 5G

List the backstores

Use the ls command to view the backstores.

/> ls /backstores

o- backstores ………………………………….. […]

o- block ……………………….. [Storage Objects: 2]

| o- LUN_1 … [/dev/xvdb (10.0GiB) write-thru deactivated]

| o- LUN_2 … [/dev/xvde (10.0GiB) write-thru deactivated]

o- fileio ………………………. [Storage Objects: 1]

| o- LUN_3 .. [/root/disk1.img (5.0GiB) write-back deactivated]

o- pscsi ……………………….. [Storage Objects: 0]

o- ramdisk ……………………… [Storage Objects: 0]

Note that the block storage objects have write-thru deactivated and the fileio storage objects have write-back deactivated by default.

The fileio storage objects can support either write-back or write-thru operation. Write-back enables the local filesystem cache, which improves performance but also increases the risk of data loss.

Specify “write-back=false” when creating the fileio storage object to specify write-thru operation. For example:

/backstores/fileio> create <name> <file> <size> write_back=false

See the following for more information about backstores: http://linux-iscsi.org/wiki/LIO