The ZFS on Linux with FUSE
Using RAID
Listing 2 demonstrates a RAID-Z array with three (virtual) disks – RAID-Z2 is similar. (The keyword for RAID-Z2 is raidz2 instead of raidz.) The commands in Listing 2 create a pool with RAID functionality. Note that ZFS will not let you extend the capacity: You can't just add new disks to the RAID pool. However, there is a workaround. As shown in Listing 3, you can replace the existing disks with three larger disks.
Listing 2
RAID-Z
$ for i in $(seq 3); do dd if=/dev/zero of=/tmp/rpool$i bs=1024 count=65536; done $ zpool create rpool raidz /tmp/rpool1 /tmp/rpool2 /tmp/rpool3
Listing 3
Replacing the Disks
$ for i in $(seq 4 6); do dd if=/dev/zero of=/tmp/rpool$i bs=1024 count=128000; done $ zpool replace rpool /tmp/rpool1 /tmp/rpool4 $ zpool replace rpool /tmp/rpool2 /tmp/rpool5 $ zpool replace rpool /tmp/rpool3 /tmp/rpool6
Alternatively, you can increase the array capacity by adding mirror, or RAID-Z, pools to the existing pool, rpool (Listing 4). This technique makes sense when the new disks are the same size as the existing disks. As long as you have more than two disks, RAID-Z is preferable to mirroring for failure safety reasons.
Listing 4
Adding Pools
$ zpool add rpool mirror /tmp/rpool4 /tmp/rpool5 $ zpool add rpool raidz /tmp/rpool4 /tmp/rpool5 /tmp/rpool6
Preventing Data Loss
Modern hard disks have self-test functions that let you check current hardware status by running a special tool. If a disk is in a critical state, ZFS lets you remove it from the pool to check the hardware:
zpool offline rpool /tmp/rpool3
If you find out the hardware has an irreparable defect, you have no alternative but to replace it with the use of the zpool replace command, as shown in Listing 3. Whereas offline simply disables the disk in the array, the replace command swaps the existing medium.
ZFS then proceeds to synchronize the pool, which can take a couple of minutes. The zpool status command keeps you up to date with the current status.
If you are wondering why Apple is so interested in ZFS, you might consider an interesting feature in Mac OS X: The "Time Machine" stores filesystem states, which lets users restore older states. Time Machine is actually based on ZFS.
In OpenSolaris, the developers have integrated this feature with Nautilus [6]. On Linux, you currently have no alternative but to use the command line. To create a snapshot, type zfs snapshot rpool@created. The @ sign and an arbitrary string following it are important. The zfs list command outputs the existing pools and snapshots (Listing 5).
Listing 5
zlist Output
$ zfs list NAME USED AVAIL REFER MOUNTPOINT rpool 409K 266M 32,2K /rpool rpool@created 0 - 32,2K -
If you change a pool – that is, copy or add files – the USED and REFER columns will have changed from the original time. If you accidentally delete some data, zfs rollback rpool@created is all it takes to restore the pool to its original state.
Conclusions
Compared with the current crop of popular Linux filesystems, ZFS has some very interesting features, such as the integration of the Volume Manager and RAID and the ability to create snapshots. Other promising traits include online compression, or the ability to export or import pools. The many benefits of ZFS make it quite clear how big a lead this filesystem has over its competitors right now. Although Oracle's Btrfs promises similar abilities, it will take some time until it is ready for production use.
Infos
- ZFS: http://opensolaris.org/os/community/zfs/
- OpenSolaris: http://www.opensolaris.com
- Btrfs: http://btrfs.wiki.kernel.org/index.php/Main_Page
- FUSE: http://fuse.sourceforge.net/
- ZFS FUSE: https://developer.berlios.de/projects/zfs-fuse/
- Snapshot integration in Nautilus: http://blogs.sun.com/erwann/entry/zfs_on_the_desktop_zfs
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.