`

ZFS on Linux

 
阅读更多

转:http://www.andybotting.com/zfs-on-linux

 

ZFS is a fantastic filesystem developed by Sun. Compared to other filesystems, it’s quite interesting as it combines both a filesystem and a logical volume manager. This allows you to get great flexibility, features and performance. It supports things like integrated snapshots, native NFSv4 ACL support and clever data integrity checking.

I’m now running a HP ProLiant MicroServer N36L which is a small NAS unit containing a 4-bay SATA enclosure. It has a low-performance AMD CPU, and comes with 1GB RAM and a 250GB harddisk. I’ve upgraded mine to 4GB of RAM and 4 x 2TB Seagate Barracuda drives.

The benefit of these units are that they’re a standard x86 machine allowing you to easily install any OS you like. They’re also really cheap and often have cash-back promotions.

I bought mine when I was in the UK and I brought it back with me to Australia. I waited until I got back to upgrade it so save me the trouble of shipping the extra harddisks on the ship.

In this post, I’ll document how to easily install ZFS on Debian Wheezy and some basic ZFS commands you’ll need to get started.

Installation

UPDATE: ZFS on Linux now has their own Debian Wheezy repository!http://zfsonlinux.org/debian.html

Install the ZFS packages

# apt-get install debian-zfs

This should use DKMS to build some new modules specific to your running kernel and install all the required packages.

Pull the new module into the kernel
# modprobe zfs

If all went well, you should see that spl and zfs have been loaded into the kernel.

 

Prepare disks

ZFS works best if you give it full access to your disks. I’m not going to run ZFS on my root filesystem, so this makes things much simpler.

Find our ZFS disks. We use the disk ID’s instead of the standard /dev/sdX naming because it’s more stable.
# ls /dev/disk/by-id/ata-*
lrwxrwxrwx 1 root root 9 Jan 21 19:18 /dev/disk/by-id/ata-ST2000DM001-1CH164_Z1E1GYH5 -> ../../sdd
lrwxrwxrwx 1 root root 9 Jan 21 08:55 /dev/disk/by-id/ata-ST2000DM001-9YN164_Z1E2ACRM -> ../../sda
lrwxrwxrwx 1 root root 9 Jan 21 08:55 /dev/disk/by-id/ata-ST2000DM001-9YN164_Z1F1SHN4 -> ../../sdb

Create partition tables on the disks so we can use them in a zpool:
# parted /dev/disk/by-id/ata-ST2000DM001-9YN164_Z1E2ACRM mklabel gpt
# parted /dev/disk/by-id/ata-ST2000DM001-9YN164_Z1F1SHN4 mklabel gpt
# parted /dev/disk/by-id/ata-ST2000DM001-1CH164_Z1E1GYH5 mklabel gpt

 

Create a new pool

ZFS uses the concept of pools in a similar way to how LVM would handle volume groups.

Create a pool called mypool, with the initial member being a RAIDZ composed of the remaining three drives.
# zpool create -m none -o ashift=12 mypool raidz /dev/disk/by-id/ata-ST2000DM001-1CH164_Z1E1GYH5/dev/disk/by-id/ata-ST2000DM001-9YN164_Z1E2ACRM/dev/disk/by-id/ata-ST2000DM001-9YN164_Z1F1SHN4

RAIDZ is a little like RAID-5. I’m using RAID-Z1, meaning that from a 3-disk pool, I can lose one disk while maintaining the data access.

NOTE: Unlike RAID, once you build your RAIDZ, you cannot add new individual disks. It’s a long story.

The -m none means that we don’t want to specify a mount point for this pool yet.

The -o ashift=12 forces ZFS to use 4K sectors instead of 512 byte sectors. Many new drives use 4K sectors, but lie to the OS about it for ‘compatability’ reasons. My first ZFS filesystem used the 512-byte sectors in the beginning, and I had shocking performance (~10Mb/s write).

Seehttp://zfsonlinux.org/faq.html#HowDoesZFSonLinuxHandlesAdvacedFormatDrives for more information about it.

# zpool list
NAME   SIZE ALLOC FREE  CAP DEDUP HEALTH ALTROOT
mypool 5.44T 1.26T 4.18T 23% 1.00x ONLINE -

Disable atime for a small I/O boost
# zfs set atime=off mypool

Deduplication is probably not worth the CPU overheard on my NAS.
# zfs set dedup=off mypool

Our pool is now ready for use.

 

Create some filesystems

Create our documents filesystem, mount and share it by NFS
# zfs create mypool/documents
# zfs set mountpoint=/mnt/documents mypool/documents
# zfs set sharenfs=on mypool/documents

Create our photos filesystem, mount and share it by NFS
# zfs create mypool/photos
# zfs set mountpoint=/mnt/photos mypool/photos
# zfs set sharenfs=on mypool/photos

Photos are important, so keep two copies of them around
# zfs set copies=2 mypool/photos

Documents are really important, so we’ll keep three copies of them on disk
# zfs set copies=3 mypool/documents

Documents are mostly text, so we’ll compress them.
# zfs set compression=on mypool/documents

Scrub

ZFS pools should be scrubbed at least once a week. It helps balance the data across the disks in your pool and to fix up any data integrity errors it might find.
# zpool scrub <pool>

To do automatic scrubbing once a week, set the following line in your root crontab
# crontab -e
...
30 19 * * 5 zpool scrub <pool>

...

分享到:
评论

相关推荐

    Introducing ZFS on Linux Understand the Basics of Storage with ZFS epub

    Introducing ZFS on Linux Understand the Basics of Storage with ZFS 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书

    Introducing ZFS on Linux Understand the Basics of Storage with ZFS 无水印原版pdf

    Introducing ZFS on Linux Understand the Basics of Storage with ZFS 英文无水印原版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如有侵权,请...

    cpp-ZFSonLinux用于Linux的官方OpenZFS实现

    在Linux环境下,ZFS on Linux库允许用户在Linux系统上利用ZFS的强大功能。 ### 一、ZFS的特点 1. **数据完整性**: ZFS通过内置的checksum校验确保数据的完整性和一致性,避免了由于硬件故障导致的数据损坏。 2. *...

    zfsonlinux.github.com:Linux网站上的官方ZFS

    zfsonlinux.github.com是ZFS on Linux项目的官方网站,提供了关于该项目的详细信息、文档、源代码以及社区支持。 该网站主要包含以下几个方面的重要知识点: 1. **项目介绍**:ZFS on Linux项目的目标是将ZFS文件...

    zfs_linux.pdf.tar.gz_ZFS_linux file system

    9. **Linux上的ZFS**:虽然ZFS最初是为Solaris设计的,但Linux社区通过开源项目如`zfsonlinux`实现了对ZFS的支持,使Linux用户也能享受到ZFS带来的优势。 10. **安装和管理**:在Linux上安装和配置ZFS通常涉及编译...

    bashshot:将 Solaris sun-auto-snap 功能复制为 shell 脚本。 使用 zfsonlinux 在 Debian 和 Ubuntu GNULinux 上进行测试

    使用 ZFSonLinux (zfsonlinux.org) 在 Debian 和 Ubuntu GNU/Linux 上进行测试。 执照 bashShot - sun-auto-snap-like implementation for ZFSonLinux using cron. Copyright (C) 2014 Hans-Filip Elo, Rovanion ...

    sbo-zfsonlinux:适用于SlackBuilds.org的ZFS-on-Linux SlackBuild脚本

    `sbo-zfsonlinux`是专为SlackBuilds.org设计的一个Shell脚本,用于在Slackware Linux系统上编译和安装ZFS-on-Linux。这个脚本包含了必要的步骤,包括获取源代码、配置编译选项、编译源码、检查依赖关系以及最终安装...

    一种Linux环境下优化ZFS同步写性能的方法.pdf

    ZFSonLinux面临的一个主要问题是,同步写性能较低,尤其是在同步写负载较重时,系统吞吐量明显下降。这是因为ZFS在处理同步写请求时,每个写请求都会单独提交日志,这种做法虽然确保了同步写语义的准确性,但也牺牲...

    运行在linux下的ZFS

    ZFS在Linux上的实现,通常被称为"ZFS on Linux"(ZOL),它允许用户在Linux环境中享受ZFS提供的强大功能。ZOL项目是一个开源项目,由一群开发者维护,旨在为Linux内核提供完整的ZFS支持。 ZFS的核心特性包括但不...

    ZFSon Linux进入部署状态.pdf

    ZFSon Linux进入部署状态.pdf

    Zabbix_ZFS_On_Linux:适用于 Linux 上 ZFS 的 Zabbix 模板

    Linux 上 ZFS 的 ##Zabbix 模板###如何使用: 将模板导入 zabbix 服务器。 授予zabbix用户权限:vi /etc/sudoers.d/zabbix Defaults:zabbix !requiretty zabbix ALL=(root) NOPASSWD: /sbin/zpool zabbix ALL=...

    containerd-zfs-snapshotter:使用本机ZFS绑定的ZFS容器快照程序

    此插件已在Arch Linux for ZFS on Linux 2.x和Ubuntu 1.8.x上进行了测试,首先定位到2.x。 用法 自容器1.1起,该插件默认为内置。 无需重新编译容器或执行代理快照程序。 设置ZFS文件系统。 ZFS文件系统名称是任意...

    mountall:针对 Linux 上 ZFS 的 Mountall 增强功能

    休闲构建说明只需像这样快速构建: $ apt-get source --build mountall开发人员构建说明克隆这个存储库: $ git clone git://github.com/zfsonlinux/mountall.git$ cd mountall按分支名称列出当前版本: $ git ...

    zfs-crypto:带有加密补丁的 Linux 上的 ZFS

    明确地说,这个分​​支与 Sun、Oracle、ZFSOnLinux、OpenSolaris、IllumOS、OpenIndiana、SmartOS、FreeBSD 等无关。 如果您运行旧池 version=30,此分支将允许您导入池并将其升级到标准池 version=5000,并且它将...

    dkms:Linux 上 ZFS 的 DKMS 增强功能

    $ git clone git://github.com/zfsonlinux/dkms.git $ cd dkms 按分支名称列出当前版本: $ git branch --list 'master/*' 或按标签名称列出以前的版本: $ git tag --list 'master/*' 签出要构建的分支名称或...

    grub:Linux 上 ZFS 的 GRUB 增强

    开发人员构建说明克隆这个存储库: $ git clone git://github.com/zfsonlinux/grub.git$ cd grub按分支名称列出当前版本: $ git branch --list 'master/*'或按标签名称列出以前的版本: $ git tag --list 'master/*...

    rpooler:zfs rpools的指导安装脚本

    在Ubuntu中安装**rpooler**,首先需要确保系统已安装了**ZFS on Linux (zfsonlinux)** 和 **Ubiquity**。Ubiquity是Ubuntu的图形化安装程序,但这里是指的Ubiquity工具集,用于处理系统初始化任务。你可以通过运行...

    ZFSZDZ-完整版123使用大全

    1. **安装与配置**:在不同的操作系统上(如FreeBSD、OpenIndiana、 illumos或通过ZFS on Linux模块)安装ZFS,并学习如何创建、配置和管理存储池。 2. **创建文件系统**:学会在存储池上创建新的ZFS文件系统,设置...

    nagios-zfs-go:Nagios插件用于ZFS池状态。 用Go编写,具有便携性和超赞性!

    Debian Wheezy 7.8(3.2.0-4-amd64),zfsonlinux 0.6.4.2,带有8磁盘的raidz2设置 用法 $ bin/check_zfs --help Usage of bin/check_zfs: -c int Capacity critical limit (80% is considered soft limit of ZFS)...

Global site tag (gtag.js) - Google Analytics