注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "ZFS/pt-br"

From Funtoo
Jump to navigation Jump to search
(Created page with "O ZFS agora está inicializado e pronto para uso.")
(Created page with "==Conceitos do ZFS==")
Line 21: Line 21:
O ZFS agora está inicializado e pronto para uso.
O ZFS agora está inicializado e pronto para uso.


== ZFS Concepts ==
==Conceitos do ZFS==


Unlike traditional filesystems like ext4 and xfs, ZFS is an all-inclusive storage technology that manages its own filesystems without using {{f|/etc/fstab}}. The ZFS concept of ''importing'' volumes and their associated filesystems makes them available for use by the operating system. This will be performed when the system boots via the {{c|zfs-import}} startup script.
Unlike traditional filesystems like ext4 and xfs, ZFS is an all-inclusive storage technology that manages its own filesystems without using {{f|/etc/fstab}}. The ZFS concept of ''importing'' volumes and their associated filesystems makes them available for use by the operating system. This will be performed when the system boots via the {{c|zfs-import}} startup script.

Revision as of 23:19, July 11, 2020

Other languages:
English • ‎español • ‎português do Brasil • ‎中文(中国大陆)‎

ZFS é um sistema de arquivos avançado que está disponível para uso no Funtoo Linux, graças ao projeto ZFS on Linux.

É fácil de configurar e usar o ZFS. Nesta simples introdução, vamos configurar o ZFS no Funtoo Linux usando um kernel debian-sources ou debian-sources-lts existente, como o que vem pré-compilado para você com o Funtoo Linux, e também usaremos nosso pool de armazenamento ZFS para armazenar dados que não fazem parte da instalação do Funtoo Linux. Isso significa que nós não precisamos nos preocupar em habilitar o suporte ao ZFS no GRUB, ou montar o ZFS para realmente inicializar o Funtoo Linux. O Funtoo Linux inicializará a partir de um sistema de arquivos não-ZFS, e como parte do processo de boot inicializa nosso pool de armazenamento ZFS e o monta no local de nossa escolha.

Instalação

Para instalar o ZFS, execute as seguintes etapas:

root # emerge zfs

Isso irá emergir as ferramentas do userspace do ZFS (zfs), bem como, os módulos do kernel do ZFS (zfs-kmod e spl). Uma vez completo, habilite o ZFS em seu runlevel padrão como se segue:

root # rc-update add zfs-import default
root # rc

O ZFS agora está inicializado e pronto para uso.

Conceitos do ZFS

Unlike traditional filesystems like ext4 and xfs, ZFS is an all-inclusive storage technology that manages its own filesystems without using /etc/fstab. The ZFS concept of importing volumes and their associated filesystems makes them available for use by the operating system. This will be performed when the system boots via the zfs-import startup script.

ZFS also generally manages the physical disks that it uses, and physical disks are added to a ZFS storage pool. Then, ZFS can create volumes from the storage pool on which files can be stored.

Unlike traditional Linux filesystems, ZFS filesystems will allocate storage on-demand from the underlying storage pool. Thus, we can set the "size" of a ZFS volume, but this space only actually allocated when files are stored on the filesystem. In contrast, traditional Linux filesystems like ext4 and xfs must be assigned underlying block storage in advance.

In ZFS terminology, a ZFS storage pool can hold the following things, all of which are considered to be datasets:

  • filesystems - these are what get mounted and you store files in. Generally, this is the main thing people use ZFS for.
  • clones - a filesystem that is created as a copy of an existing snapshot.
  • snapshots - a read-only copy of a filesystem at a given point in time.
  • volume - a dataset that acts as a block device, such as a swap device.

When you inspect the contents of a ZFS storage pool, you will see potentially all these different types of things listed as the contents of the pool, and their names will appear in a pool/path[@snapshot] format. Pool is the name of the storage pool. Path is a slash-delimited path name for the component, and the slashes don't represent directories but a logical organizational hierarchy for the dataset in the pool.

Creating a Storage Pool

To create a basic ZFS storage pool, you will need an extra empty disk. Perform the following steps:

root # zpool create mypool /dev/sdxy

/dev/sdxy should be an unused disk. You may need to use the following command if this disk contains any pre-existing data on it:

root # zpool create -f mypool /dev/sdxy

Once your storage pool is created, you can verify its existence with the zpool status command:

root # zpool status
  pool: mypool
 state: ONLINE
  scan: none requested
config:

	NAME        STATE     READ WRITE CKSUM
	mypool      ONLINE       0     0     0
	  sdb       ONLINE       0     0     0

errors: No known data errors
root #

And if you type zfs list, you will likely see something like this:

root # # zfs list
NAME                                                                          USED  AVAIL  REFER  MOUNTPOINT
mypool                                                                       2.19G   459G    96K  none

Notice the mountpoint entry of None. While it is possible to mount your storage pool directly and use it as a filesystem, it is best to create a filesystem as a sub-path within your pool's namespace, as follows:

root # zfs create mypool/home
root # zfs list
NAME                                                                          USED  AVAIL  REFER  MOUNTPOINT
mypool                                                                       2.19G   459G    96K  none
mypool/home                                                                    96K   459G    96K  none

As you can see above, although we have created a ZFS filesystem, it is only using 96K of storage on our pool, although there are 459GB available. You can also see that the filesystem is currently not mounted. Rather than use the mount command, let's change that the ZFS way:

root # mkdir /data/home
root # zfs set mountpoint=/data/home mypool/home
root # mount
...
mypool/home on /data/home type zfs (rw,xattr,posixacl)

We have now set the mountpoint property on our filesystem, and can see that it is now mounted where we want it. ZFS will remember that our mypool/home filesystem gets mounted at /data/home. Most people will want their filesystems to be automatically mounted at boot and will perform the following steps to make this happen:

root # rc-update add zfs-mount default

You should now be at the point where you can begin to use ZFS for a variety of tasks. While there is a lot more to ZFS than what is covered in this short introduction, you should now have a good understanding of the fundamental concepts on which ZFS is based.