Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Oracle Solaris 11 Advanced Administration Cookbook.docx
Скачиваний:
3
Добавлен:
01.07.2025
Размер:
3.14 Mб
Скачать

Creating zfs storage pools and filesystems

To start playing with ZFS, the first step is to create a storage pool, and afterwards, all filesystems will be created inside these storage pools. To accomplish the creation of a storage pool, we have to decide which raid configuration we will use (stripe, mirror, or RAID-Z) to create the storage pool and, afterwards, the filesystems on it.

Getting ready

To follow this recipe, it is necessary to use a virtual machine (VMware or VirtualBox) that runs Oracle Solaris 11 with 4 GB RAM and eight 4 GB disks. Once the virtual machine is up and running, log in as the root user and open a terminal.

How to do it…

A storage pool is a logical object, and it represents the physical characteristics of the storage and must be created before anything else. To create a storage pool, the first step is to list all the available disks on the system and choose what disks will be used by running the following command as the root role:

root@solaris11-1:~# format

Searching for disks...done

AVAILABLE DISK SELECTIONS:

  1. c8t0d0 <VBOX-HARDDISK-1.0-80.00GB>

Chapter 2

/pci@0,0/pci1000,8000@14/sd@0,0

  1. c8t1d0 <VBOX-HARDDISK-1.0-16.00GB>

/pci@0,0/pci1000,8000@14/sd@1,0

  1. c8t2d0 <VBOX-HARDDISK-1.0-4.00GB>

/pci@0,0/pci1000,8000@14/sd@2,0

  1. c8t3d0 <VBOX-HARDDISK-1.0 cyl 2046 alt 2 hd 128 sec 32>

/pci@0,0/pci1000,8000@14/sd@3,0

  1. c8t4d0 <VBOX-HARDDISK-1.0 cyl 2046 alt 2 hd 128 sec 32>

/pci@0,0/pci1000,8000@14/sd@4,0

  1. c8t5d0 <VBOX-HARDDISK-1.0 cyl 2046 alt 2 hd 128 sec 32>

/pci@0,0/pci1000,8000@14/sd@5,0

  1. c8t6d0 <VBOX-HARDDISK-1.0 cyl 2046 alt 2 hd 128 sec 32>

/pci@0,0/pci1000,8000@14/sd@6,0

  1. c8t8d0 <VBOX-HARDDISK-1.0 cyl 2046 alt 2 hd 128 sec 32>

/pci@0,0/pci1000,8000@14/sd@8,0

  1. c8t9d0 <VBOX-HARDDISK-1.0 cyl 2046 alt 2 hd 128 sec 32>

/pci@0,0/pci1000,8000@14/sd@9,0

  1. c8t10d0 <VBOX-HARDDISK-1.0 cyl 2046 alt 2 hd 128 sec 32>

/pci@0,0/pci1000,8000@14/sd@a,0

  1. c8t11d0 <VBOX-HARDDISK-1.0 cyl 2046 alt 2 hd 128 sec 32>

/pci@0,0/pci1000,8000@14/sd@b,0 Specify disk (enter its number):

Following the selection of disks, create a zpool create storage pool and verify the information about this pool using the zpool list and zpool status commands. Before these steps, we have to decide the pool configuration: stripe (default), mirror, raidz, raidz2, or raidz3. If the configuration isn't specified, stripe (raid0) will be assumed as default. Then, a pool is created by running the following command:

root@solaris11-1:~# zpool create oracle_stripe_1 c8t3d0 c8t4d0

'oracle_stripe_1' successfully created, but with no redundancy; failure of one device will cause loss of the pool

To list the pool, execute the following commands:

root@solaris11-1:~# zpool list oracle_stripe_1

NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT

oracle_stripe_1 7.94G 122K 7.94G 0% 1.00x ONLINE -

ZFS

To verify the status of the pool, run the following commands:

root@solaris11-1:~# zpool status oracle_stripe_1

pool: oracle_stripe_1 state: ONLINE

scan: none requested config:

NAME

STATE

READ

WRITE

CKSUM

oracle_stripe_1

ONLINE

0

0

0

c8t3d0

ONLINE

0

0

0

c8t4d0

ONLINE

0

0

0

errors: No known data errors

Although it's out of the scope of this chapter, we can list some related performance information by running the following command:

root@solaris11-1:~# zpool iostat -v oracle_stripe_1

capacity operations bandwidth

pool

alloc

free

read

write

read

write

----------------

-----

-----

-----

-----

-----

-----

oracle_stripe_1

128K

7.94G

0

0

794

56

c8t3d0

53K

3.97G

0

0

391

24

c8t4d0

74.5K

3.97G

0

0

402

32

----------------

-----

-----

-----

-----

-----

-----

If necessary, a second and third storage pool can be created using the same commands but taking different disks and, in this case, by changing to the mirror and raidz configurations, respectively. This task is accomplished by running the following commands:

root@solaris11-1:~# zpool create oracle_mirror_1 mirror c8t5d0 c8t6d0

root@solaris11-1:~# zpool list oracle_mirror_1

NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT

oracle_mirror_1 3.97G 85K 3.97G 0% 1.00x ONLINE - root@solaris11-1:~# zpool status oracle_mirror_1

pool: oracle_mirror_1 state: ONLINE

scan: none requested config:

Chapter 2

NAME

STATE

READ

WRITE

CKSUM

oracle_mirror_1

ONLINE

0

0

0

mirror-0

ONLINE

0

0

0

c8t5d0

ONLINE

0

0

0

c8t6d0

ONLINE

0

0

0

errors: No known data errors

root@solaris11-1:~# zpool create oracle_raidz_1 raidz c8t8d0 c8t9d0 c8t10d0

root@solaris11-1:~# zpool list oracle_raidz_1

NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT

oracle_raidz_1 11.9G 176K 11.9G 0% 1.00x ONLINE - root@solaris11-1:~# zpool status oracle_raidz_1

pool: oracle_raidz_1 state: ONLINE

scan: none requested config:

NAME

STATE

READ

WRITE

CKSUM

oracle_raidz_1

ONLINE

0

0

0

raidz1-0

ONLINE

0

0

0

c8t8d0

ONLINE

0

0

0

c8t9d0

ONLINE

0

0

0

c8t10d0

ONLINE

0

0

0

errors: No known data errors

Once the storage pools are created, it's time to create filesystems in these pools. First, let's create a filesystem named zfs_stripe_1 in the oracle_stripe_1 pool. Execute the following command:

root@solaris11-1:~# zfs create oracle_stripe_1/zfs_stripe_1

Repeating the same syntax, it's easy to create two new filesystems named zfs_mirror_1

and zfs_raidz_1 in oracle_mirror_1 and oracle_raidz_1, respectively:

root@solaris11-1:~# zfs create oracle_mirror_1/zfs_mirror_1

root@solaris11-1:~# zfs create oracle_raidz_1/zfs_raidz_1

ZFS

The listing of recently created filesystems is done by running the following command:

root@solaris11-1:~# zfs list

NAME

USED

AVAIL

REFER MOUNTPOINT

(truncated output)

oracle_mirror_1

124K

3.91G

32K /oracle_mirror_1

oracle_mirror_1/zfs_mirror_1 mirror_1

31K

3.91G

31K /oracle_mirror_1/zfs_

oracle_raidz_1

165K

7.83G

36.0K /oracle_raidz_1

oracle_raidz_1/zfs_raidz_1 zfs_raidz_1

34.6K

7.83G

34.6K /oracle_raidz_1/

oracle_stripe_1

128K

7.81G

32K /oracle_stripe_1

oracle_stripe_1/zfs_stripe_1 stripe_1

31K

7.81G

31K /oracle_stripe_1/zfs_

(truncated output)

root@solaris11-1:~# zfs list oracle_stripe_1 oracle_mirror_1 oracle_ raidz_1

NAME USED AVAIL REFER MOUNTPOINT

oracle_mirror_1 124K 3.91G 32K /oracle_mirror_1 oracle_raidz_1 165K 7.83G 36.0K /oracle_raidz_1 oracle_stripe_1 128K 7.81G 32K /oracle_stripe_1

The ZFS engine has automatically created the mount-point directory for all the created filesystems, and it has been mounted on them. This can also be verified by executing the following command:

root@solaris11-1:~# zfs mount

rpool/ROOT/solaris /

rpool/ROOT/solaris/var /var

rpool/VARSHARE /var/share

rpool/export /export

rpool/export/home /export/home

oracle_mirror_1 /oracle_mirror_1 oracle_mirror_1/zfs_mirror_1 /oracle_mirror_1/zfs_mirror_1 oracle_stripe_1 /oracle_stripe_1

Chapter 2

oracle_stripe_1/zfs_stripe_1 /oracle_stripe_1/zfs_stripe_1 rpool /rpool

oracle_raidz_1 /oracle_raidz_1 oracle_raidz_1/zfs_raidz_1 /oracle_raidz_1/zfs_raidz_1

The last two lines confirm that the ZFS filesystems that we created are already mounted and

ready to use.

An overview of the recipe

This recipe has taught us how to create a storage pool with different configurations such as stripe, mirror, and raidz. Additionally, we learned how to create filesystems in these pools.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]