Vous êtes sur la page 1sur 6

Aide

# # # # zpool [-?] man zpool zfs [-?] man zfs

Pools

Mmo ZFS

Cration / destruction Commande gnrique :


# zpool create [-fn] [-R root] [-m mountpoint] <pool> \ [nraid] <vdev1> <vdev2>... [[nraid] <vdevX> <vdevY> ...]

Pool basique (simple stripe) :


# zpool create <pool> <vdev1> <vdev1> [<vdev2> ...]

Miroir :
# zpool create <pool> mirror <vdev1>...<vdevX> [mirror <vdevA>...<vdevZ> ...]

RAID-Z / RAID-Z2 :
# zpool create <pool> raidz|raidz2 <vdevA>...<vdevZ> ...

Avec spare (les mmes spares peuvent tre partags entre diffrents pools) :
# zpool create <pool> ..... spare <vdev1> [<vdev2> ...]

ZIL (log) ddi :


# zpool create <pool> ..... log [mirror] <vdev1> [<vdev2> ...]

Cration dun pool avec cache ddi :


# zpool create <pool> ..... cache <vdev1> [<vdev2> ...]

Destruction :
# zpool destroy [-f] <pool>

Gestion des devices Ajouter des devices :


# zpool add <pool> [nraid] <vdev1> [<vdev2> ...]

Ajouter du spare :
# zpool add <pool> spare <vdev1> [<vdev2> ...]

Ajouter une zone de log (ZIL) :


# zpool add <pool> log [mirror] <vdev1> [<vdev2> ...]

Ajouter une zone de cache :


# zpool add <pool> cache <vdev1> [<vdev2> ...]

Ajouter une patte de miroir / transformer un stripe en miroir :


# zpool attach <pool> <vdev1> [<vdev2> ...]

Retirer une patte de miroir :


# zpool detach <pool> <vdev1> [<vdev2> ...]

Retirer des spares :


# zpool remove <pool> <vdev1> [<vdev2> ...]

Online /offline de devices :


# zpool online <pool> <vdev1> [<vdev2> ...] # zpool offline <pool> [-t] <vdev1> [<vdev2> ...] -t : temporaire (repasse online au reboot)

Remplacement dun device :


# zpool replace -f <pool> <ancien_vdev> [<nouveau_vdev>]

Ce mmo nest pas exhaustif ; seules les oprations les plus courantes sont rappeles. Se rfrer aux manpages et la documentation pour plus de dtails, ou pour les options plus spcifiques. Certaines fonctionnalits prsentes ne sont pas disponibles dans les premires versions de ZFS

Import / export Export de pools :


# zpool export [-f] <pool> [<pool2> ...]

Lister les pools importables :


# zpool import [-d dir] [-D] -D : pools dtruits par zpool destroy

Import :
# zpool import [-d dir] [-D] [-f] [-o opts] [-R root] -a # zpool import [-d dir] [-D] [-f] [-o opts] [-R root ] <pool | pool_id> [newpool]

AGD 2007/2009 Mmo ZFS AGD 2007/2009 1/12

Etat / informations Afficher / modifier des proprits :


# zpool get all|proprit <pool> # zpool set proprit=valeur <pool>

Relatifs aux donnes, snapshot & clones non comptabiliss :


# # # # zfs zfs zfs zfs set set get get refquota=[none|taille] <filesystem> refreservation=[none|taille] <filesystem> refquota <filesystem> refreservation <filesystem>

Liste :
# zpool list [-H] [-o champ[,champ]*] [pool] ...

Partage NFS
# zfs set sharenfs=[on|off|options...] <filesystem> # zfs get sharenfs <filesystem> # zfs share|unshare <filesystem>|-a Si sharenfs=off (dfaut), passer par les outils classiques (/etc/dfs/dfstab, share, unshare, )

Etat :
# zpool status [-vx] [pool] ...

iostat :
# zpool iostat [-v] [pool] ... [interval [count]]

Arrter / stopper un scrub :


# zpool scrub pool # zpool scrub -s pool

Partage CIFS
# zfs set sharesmb=[on|off|proprit=valeur...] <filesystem> # zfs get sharesmb <filesystem> # sharemgr show pv (pour vrifier)

Effacer les erreurs des devices :


# zpool clear <pool> [vdev]

Historique des actions / modifications :


# zpool history <pool> ...

Afficher / upgrader la version de ZFS :


# zpool upgrade [-v] # zpool ugrade [-a | pool]

Compression
# zfs set compression=[on|off|gzip|gzip-N] <filesystem> # zfs get compression <filesystem> Lalgorithme par dfaut est lzjb.

Filesystems
Cration / destruction / renommage
# zfs create [[-o proprit=valeur] ... ] <filesystem> # zfs destroy [-rRf] <filesystem> # zfs rename [-rRf] <filesystem>

Snapshots / clones Crer / dtruire / lister les snapshots :


# zfs snapshot <filesystem>@<nom_snap> # zfs destroy <filesystem>@<nom_snap> # zfs list t snapshot

Renommer les snapshots :


# zfs rename <filesystem>@<ancien_nom_snap> [<filesystem>]@<nouveau_nom_snap> # zfs rename <filesystem>@<ancien_nom_snap> @<nouveau_nom_snap> # zfs rename r <filesystem>@<ancien_nom_snap> [<filesystem>]@<nouveau_nom_snap>

Modifications / consultation des proprits (aprs cration)


# zfs set proprit1=valeur,proprit2=valeur ... <filesystem> # zfs get proprit1,proprit2 ... <filesystem>

Rollback dun snapshot :


# zfs unmount [-f] <filesystem> # zfs rollback [-r][-R] <filesystem>@<nom_snap> Option -r ncessaire sil ne sagit pas du plus rcent snapshot (snapshots intermdiaires seront dtruits) Option R ncessaire sil existe des clones de ces snapshots intermdiaires (seront dtruits) # zfs mount <filesystem>

Montage / dmontage / points de montage Points de montage automatiques


# # # # # # # # zfs create [m mountpoint=/point/de/montage | none] ... <filesystem> zfs set mountpoint=/point/de/montage <filesystem> zfs mount zfs mount [-o opts] [-O] -a zfs mount [-o opts] [-O] <filesystem> zfs unmount [-f] -a zfs unmount [-f] <filesystem|mountpoint> umount [-f] </point/de/montage>

Crer un clone dun filesystem :


# zfs snapshot <filesystem>@<nom_snap> # zfs clone <filesystem>@<nom_snap> <clone> Une fois cr, le clone se manipule comme un filesystem ZFS standard

Remplacer un filesystem par son clone :


# # # # zfs zfs zfs zfs promote <clone> rename <filesystem> <filesystem>_ORIG rename <clone> <filesystem> destroy <filesystem>_ORIG

Points de montage de type legacy


# # # # zfs create m mountpoint=legacy ... <filesystem> zfs set mountpoint=legacy <filesystem> mkdir p /point/de/montage mount F zfs [-o opts] <filesystem> </point/de/montage> Si ncessaire de monter le fs au boot, mettre jour /etc/vfstab # umount [-f] </point/de/montage>

Sauvegarde / Restauration / Transfert


Note : les outils traditionnels (tar, cpio, netBackup, Networker, ) sont capables de sauvegarder du ZFS

Sauvegarde complte dun snapshot :


# zfs send <fs>@<nom_snap> | [ssh host2] zfs receive <fs_stockage> recv peut tre utilis comme alias receive

Quotas / rservation Relatifs aux donnes + ventuels snapshots & clones :


# # # # zfs zfs zfs zfs set set get get quota=[none|taille] <filesystem> reservation=[none|taille] <filesystem> quota <filesystem> reservation <filesystem>
AGD 2007/2009 2/12

Sauvegarde incrmentale :
# zfs send i [<fs>@]<nom_snap1> <fs>@<nom_snap2> | \ [ssh host2] zfs receive F <fs_stockage> Les snapshots sont cits du plus ancien au plus rcent

Sauvegarde dans un fichier :


# zfs send <fs>@<nom_snap> > backupfile # zfs send <fs>@<nom_snap> | gzip > backupfile.gz
Mmo ZFS AGD 2007/2009 3/12

Mmo ZFS

Restauration dun snapshot sauvegard :


# zfs send <fs_stockage>@<nom_snap> | [ssh host1] zfs recv <fs> # zfs recv [-d] <fs> < oleron_api

Boot
Rinstaller le bootblock
{2} ok boot cdrom|net sw # zpool import R /a rpool # zfs mount rpool/ROOT/<fs_root> # installboot /a/usr/platform/`uname i`/lib/fs/zfs/bootblk /dev:rdsk/cXtYdZsW

Snapshot cumulatif :
# zfs send I [<fs>@]<nom_snap1> <fs>@<nom_snap4> | \ [ssh host2] zfs recv F <fs_stockage>@gros_snap dtruire les snapshots 2, 3 et 4 puis restaurer gros_snap : on retrouve les snapshots 1, 2, 3 et 4 : # zfs destroy <fs>@<nom_snap2> # zfs destroy <fs>@<nom_snap3> # zfs destroy <fs>@<nom_snap4> # zfs send <fs_stockage>@gros_snap | ssh host1 zfs recv -d -F <fs> # zfs list

Documentation
Best Practices / Tuning / Troubleshooting :
http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide http://www.solarisinternals.com/wiki/index.php/ZFS_Evil_Tuning_Guide http://www.solarisinternals.com/wiki/index.php/ZFS_Troubleshooting_Guide

Etat / informations Afficher la liste / des proprits :


# zfs list [-rH] [-o proprit[,proprit]...] [-t type[,type]...] \ [-s proprit [-s proprit]...] [-S proprit [-S proprit]...] \ [filesystem|snapshot] ... # zfs get [-rHp] [-o champ[,champ]...] [-s source[,source]...] \ <all | proprit [,proprit]...> [filesystem|snapshot] ...

Filesystems Wiki:
http://wikis.sun.com/display/BigAdmin/Filesystems

Modifier des proprits :


# zfs set <proprit=valeur> <filesystem> ... # zfs inherit [-r] <proprit> <filesystem> ...

Docs.sun.com :
http://search.sun.com/docs/index.jsp?col=docs_en&locale=en&qt=zfs

Bigadmin :
http://www.sun.com/bigadmin/topics/zfs/

Volumes /dev/zvol/{dsk,rdsk}/
Cration / destruction / renommage
# zfs create [-s] [-b blocksize] [[-o proprit=valeur] ...] -V <taille> <volume> # zfs destroy [-rRf] <volume> # zfs rename [-rRf] <volume>

Target iSCSI
# zfs set sharescsi=on <volume> # iscsitadm list target

Swap & dump devices Grs automatiquement lors de linstallation dun filesystem root ZFS (installation from scratch ou migration depuis un filesystem root UFS). Attention : pas de fichier swap sur un filesystem ZFS. Etat / informations Afficher la liste / des proprits :
# zfs list [-rH] [-o proprit[,proprit]...] [-t type[,type]...] \ [-s proprit [-s proprit]...] [-S proprit [-S proprit]...] \ [volume] ... # zfs get [-rHp] [-o champ[,champ]...] [-s source[,source]...] \ <all | proprit [,proprit]...> [volume] ...

Modifier des proprits :


# zfs set <proprit=valeur> <volume> ... # zfs inherit [-r] <proprit> <volume> ...

Mmo ZFS

AGD 2007/2009

4/12

Mmo ZFS

AGD 2007/2009

5/12

Annexe A : proprit des pools


Proprit altroot Type String Dfaut off Description Identifies an alternate root directory. If set, this directory is prepended to any mount points within the pool. This property can be used when examining an unknown pool, if the mount points cannot be trusted, or in an alternate boot environment, where the typical paths are not valid. Read-only value that identifies the amount of storage that is available within the pool. This property can also be referred to by its shortened column name, avail. autoreplace Boolean off Controls automatic device replacement. If set to off, device replacement must be initiated by the administrator by using the zpool replace command. If set to on, any new device, found in the same physical location as a device that previously belonged to the pool, is automatically formatted and replaced. The default behavior is off. This property can also be referred to by its shortened column name, replace. Identifies the default bootable dataset for the root pool. This property is expected to be set mainly by the installation and upgrade programs. Read-only value that identifies the percentage of pool space used. This property can also be referred to by its shortened column name, cap. delegation Boolean on Controls whether a non-privileged user can be granted access permissions that are defined for the dataset. Controls the system behavior in the event of catastrophic pool failure. This condition is typically a result of a loss of connectivity to the underlying storage device(s) or a failure of all devices within the pool. The behavior of such an event is determined by one of the following values: wait blocks all I/O access until the device connectivity is restored and the errors are cleared by using the zpool clear command. This is the default behavior. continue returns EIO to any new write I/O requests, but allows reads to any of the remaining healthy devices. Any write requests that have yet to be committed to disk would be blocked. After the device is reconnected or replaced, the errors must be cleared with the zpool clear command. panic prints out a message to the console and generates a system crash dump.

Proprit version

Type Number

Dfaut N/A

Description Identifies the current on-disk version of the pool. The value of this property can be increased, but never decreased. The preferred method of updating pools is with the zpool upgrade command, although this property can be used when a specific version is needed for backwards compatibility. This property can be set to any number between 1 and the current version reported by the zpool upgrade -v command. The current value is an alias for the latest supported version.

available

Number

N/A

bootfs

Boolean

N/A

capacity

Number

N/A

failmode

String

wait

guid health

String String

N/A N/A

Read-only property that identifies the unique identifier for the pool. Read-only property that identifies the current health of the pool, as either ONLINE, DEGRADED, FAULTED, OFFLINE, REMOVED, or UNAVAIL. Read-only property that identifies the total size of the storage pool. Read-only property that identifies the amount of storage space used within the pool.

size used

Number Number

N/A N/A

Mmo ZFS

AGD 2007/2009

6/12

Mmo ZFS

AGD 2007/2009

7/12

Annexe B : proprit des filesystems


Proprit aclinherit Type String Dfaut secure Description Controls how ACL entries are inherited when files and directories are created. The values are discard, noallow, secure, and passthrough. Controls how an ACL entry is modified during a chmod operation. The values are discard, groupmask, and passthrough.

Proprit

Type

Dfaut

Description are 1, 2 or 3. These copies are in addition to any pool-level redundancy. Space used by multiple copies of user data is charged to the corresponding file and dataset and counts against quotas and reservations. In addition, the used property is updated when multiple copies are enabled. Consider setting this property when the file system is created because changing this property on an existing file system only affects newly written data.

aclmode

String

groupmask

creation atime Boolean on Controls whether the access time for files is updated when they are read. Turning this property off avoids producing write traffic when reading files and can result in significant performance gains, though it might confuse mailers and other similar utilities. Read-only property that identifies the amount of space available to the dataset and all its children, assuming no other activity in the pool. Because space is shared within a pool, available space can be limited by various factors including physical pool size, quotas, reservations, or other datasets within the pool. This property can also be referenced by its shortened column name, avail. mountpoint canmount Boolean on Controls whether the given file system can be mounted with the zfs mount command. This property can be set on any file system and the property itself is not inheritable. However, when this property is set to off, a mountpoint can be inherited to descendent file systems, but the file system itself is never mounted. When the noauto option is set, a dataset can only be mounted and unmounted explicitly. The dataset is not mounted automatically when the dataset is created or imported, nor is it mounted by the zfs mount-a command or unmounted by the zfs unmount-a command. checksum String on Controls the checksum used to verify data integrity. The default value is on, which automatically selects an appropriate algorithm, currently fletcher2. The values are on, off, fletcher2, fletcher4, and sha256. A value of off disables integrity checking on user data. A value of off is not recommended. Enables or disables compression for this dataset. The values are on, off, and lzjb, gzip, or gzip-N. Currently, setting this property to lzjb, gzip, or gzip-N has the same effect as setting this property to on. The default value is off. Enabling compression on a file system with existing data only compresses new data. Existing data remains uncompressed. readonly This property can also be referred to by its shortened column name, compress. compressratio Number N/A Read-only property that identifies the compression ratio achieved for this dataset, expressed as a multiplier. Compression can be turned on by running zfs set compression=on dataset. Calculated from the logical size of all files and the amount of referenced physical data. Includes explicit savings through the use of the compression property. referenced copies
Mmo ZFS

String

N/A

Read-only property that identifies the date and time that this dataset was created. Controls the ability to open device files in the file system. Controls whether programs within this file system are allowed to be executed. Also, when set to off, mmap(2) calls with PROT_EXEC are disallowed. Read-only property that indicates whether this file system, clone, or snapshot is currently mounted. This property does not apply to volumes. Value can be either yes or no. Controls the mount point used for this file system. When the mountpoint property is changed for a file system, the file system and any children that inherit the mount point are unmounted. If the new value is legacy, then they remain unmounted. Otherwise, they are automatically remounted in the new location if the property was previously legacy or none, or if they were mounted before the property was changed. In addition, any shared file systems are unshared and shared in the new location. Read-only property for cloned file systems or volumes that identifies the snapshot from which the clone was created. The origin cannot be destroyed (even with the -r or -f options) as long as a clone exists. Non-cloned file systems have an origin of none.

devices exec

Boolean Boolean

on on

available

Number

N/A

mounted

boolean

N/A

String

N/A

origin

String

N/A

quota

Number (or none)

none

compression

String

off

Limits the amount of space a dataset and its descendents can consume. This property enforces a hard limit on the amount of space used, including all space consumed by descendents, including file systems and snapshots. Setting a quota on a descendent of a dataset that already has a quota does not override the ancestor's quota, but rather imposes an additional limit. Quotas cannot be set on volumes, as the volsize property acts as an implicit quota. Controls whether this dataset can be modified. When set to on, no modifications can be made to the dataset. This property can also be referred to by its shortened column name, rdonly.

Boolean

off

recordsize

Number

128K

Specifies a suggested block size for files in the file system. This property can also be referred to by its shortened column name, recsize.

Number

N/A

Number

Sets the number of copies of user data per file system. Available values
AGD 2007/2009 8/12 Mmo ZFS

Read-only property that identifies the amount of data accessible by this dataset, which might or might not be shared with other datasets in the
AGD 2007/2009 9/12

Proprit

Type

Dfaut

Description pool. When a snapshot or clone is created, it initially references the same amount of space as the file system or snapshot it was created from, because its contents are identical. This property can also be referred to by its shortened column name, refer.

Proprit

Type

Dfaut

Description cannot be changed once the volume has been written, so set the block size at volume creation time. The default block size for volumes is 8 Kbytes. Any power of 2 from 512 bytes to 128 Kbytes is valid. This property can also be referred to by its shortened column name, volblock.

zoned

Boolean

N/A

refquota

Number (or none)

none

Sets the amount of space that a dataset can consume. This property enforces a hard limit on the amount of space used. This hard limit does not include space used by descendents, such as snapshots and clones. xattr Boolean on Sets the minimum amount of space that is guaranteed to a dataset, not including descendents, such as snapshots and clones. When the amount of space that is used is below this value, the dataset is treated as if it were taking up the amount of space specified by refreservation. The refreservation reservation is accounted for in the parent datasets' space used, and counts against the parent datasets' quotas and reservations. If refreservation is set, a snapshot is only allowed if enough free pool space is available outside of this reservation to accommodate the current number of referenced bytes in the dataset. This property can also be referred to by its shortened column name, refreserv.

Indicates whether this dataset has been added to a non-global zone. If this property is set, then the mount point is not honored in the global zone, and ZFS cannot mount such a file system when requested. When a zone is first installed, this property is set for any added file systems.. Indicates whether extended attributes are enabled or disabled for this file system. The default value is on.

refreservation

Number (or none)

none

Fin du document

reservation

Number (or none)

none

The minimum amount of space guaranteed to a dataset and its descendents. When the amount of space used is below this value, the dataset is treated as if it were using the amount of space specified by its reservation. Reservations are accounted for in the parent datasets' space used, and count against the parent datasets' quotas and reservations. This property can also be referred to by its shortened column name, reserv.

setuid sharenfs

Boolean String

on off

Controls whether the setuid bit is honored in the file system. Controls whether the file system is available over NFS, and what options are used. If set to on, the zfs share command is invoked with no options. Otherwise, the zfs share command is invoked with options equivalent to the contents of this property. If set to off, the file system is managed by using the legacy share and unshare commands and the dfstab file. Controls whether the .zfs directory is hidden or visible in the root of the file system. Read-only property that identifies the dataset type as filesystem (file system or clone), volume, or snapshot. Read-only property that identifies the amount of space consumed by the dataset and all its descendents. For volumes, specifies the logical size of the volume. For volumes, specifies the block size of the volume. The block size
AGD 2007/2009 10/12 Mmo ZFS AGD 2007/2009 11/12

snapdir

String

hidden

type

String

N/A

used

Number

N/A

volsize volblocksize
Mmo ZFS

Number Number

N/A 8 Kbytes