Translation How-to set up a redundant storage pool with ZFS and Ubuntu

Source: Internet
Author: User

If your data is not redundant and there is no backup, it is almost nonexistent.

Large companies will handle critical transactional data with huge volumes of data and take data redundancy and backup measures to ensure data security. has become a standard within the industry. But for small-and medium-sized companies, SOHO (small office, Home Office), they cannot afford the loss of data loss.

Unlike big companies, many small businesses, Soho and personal studios don't even have IT departments, let alone CTOs and CIOs.

I have personally handled huge amounts of data – I have more than 6TB of storage. I have a file server at home;
It's one of the most important parts of my life, with my family photos and all My documents stored on it.

This approach has many advantages:
Because all of my data is stored in the same location, I can easily manage, maintain and protect it.
This is a centralized file server, so anyone can access these files on my local network.
I can work on multiple devices – laptops, PCs, tablets, phones without worrying about copying files between them.
If my main personal computer or laptop is broken, I don't have to worry about rescuing data stored on my computer. Because nothing is ever saved in my home such a device.

But it's not a good idea to put all the eggs in one basket. So, you have to add redundancy to it to ensure that there are multiple physical backups.

ZFS is the answer.

Here are two excellent file systems to do this work: ZFS and Btrfs.
Btrfs is very new and still in development, so I don't recommend using it.
ZFS, on the other hand, is a time-tested, stable and extremely rich feature:
It includes storage pool (zpool), copy-on-write, snapshot, data integrity verification, automatic repair, protection function, etc.
But there are also some licensing issues around ZFS that I have written before.

At first, I thought about FreeNAS and ran for a while, but I prefer to use Linux and have full control of my server. So I chose the ZFS file system with Ubuntu.

Here's how to get started with ZFS on Ubuntu.
Requirements:
14.04 Ubuntu Server
There are at least three hard drives. One of the most Ubuntu systems, it must be installed on a separate SSD or hard drive, two for storage pools.
Memory at least 8GB (1GB for Ubuntu, then increase 1GB RAM per 1TB data added)
Any decent CPU.

Suggestions:
I strongly recommend using the LTS (long-term support) version of Ubuntu on any file server.
To create a raid-z, you need at least two SATA hard disks with the same storage capacity. If you have a hard disk with different capacity, the total storage will be the size of the smaller hard drive.
I strongly recommend having a third external hard drive so that you can back up your data regularly.

Once you have a hard drive, you can install ZFS. Although ZFS is preinstalled in the upcoming Ubuntu16.04 release, we need to install PPA in 14.04.

sudo apt-add-repository ppa:zfs-native/stable

Update Repo after

sudo apt-get update

Now install the software and load the module:

sudo apt-get install ubuntu-zfssudo/sbin/modprobe ZFS

Then run the following command to check if there is a "pools" or hard drive present on the system:

sudo zfs list

The result of the output should be no datasets available . We know there is no data set created here, but we want to verify that it is installed correctly.

Now is the time to create a disk drive storage pool. Because you need to identify the drive on your system. So the first time you run the LSBLK command to identify each drive.

sudo lsblk

Note the name of the block device, which should be ' SDA, SDB, SDC, '

Now we need to find the ID of each drive and we'll use it in the "pool" of the drive.

sudo ls-l/dev/disk/by-id/

This command will give you a long output. This is an example of my system (in my Ubuntu system, I have deleted the output of the drive SDA. In my case, I will use the two drive SDC and SDD in the pool:

[Email protected]:~$ sudo ls-l/dev/disk/by-id/total 0lrwxrwxrwx 1 root root 9 Feb 17:48 ata-wdc_wd40efrx-68wt0n0_wd-w cc4e0318132. /.. /SDCLRWXRWXRWX 1 root root 9 Feb 17:48 ata-wdc_wd40efrx-68wt0n0_wd-wcc4e4lrj111. /.. /SDDLRWXRWXRWX 1 root root 9 Feb 17:48 wwn-0x50014ee20922e8a8. /.. /SDCLRWXRWXRWX 1 root root 9 Feb 17:48 wwn-0x50014ee20b453ec7. /.. /sddfrom This output note to the IDs that start with ' wwn ', so in my case it is ' wwn-0x50014ee20922e8a8 ' and ' wwn-0x500 14ee20b453ec7 '

Now let me create zpool in this format:

Zpool create-f-o ashift=12-m <mount_point> <pool_name> raidz <ID_of_the_first_drive> <id_of_the_ Second_drive>

1

ZpoolCreate -F -o Ashift= A -m <Mount_point> <Pool_name> Raidz <id_of_the_first_drive> <id_of_the_second_drive>

In my case, hanging at the point is '/mnt/bank ', pool is ' swapool '

Zpool create-f-o ashift=12-m/mnt/bank swapool raidz wwn-0x50014ee20922e8a8 wwn-0x50014ee20b453ec7

Once the check status is done, this may take a while.

sudo zfs list

This time, you'll get some output, which means your pool was created successfully. The two hard drives now mirror the files. To further increase redundancy, you can add more drives.

You have more work to do before you begin copying files to the pool. You must create a dataset and store the data in those datasets. Datasets are created like directories or folders by the functionality of ZFS. You can create some datasets for different file types or just one dataset. Once you have created a dataset, you can create a normal directory or file in it.

Here is the command to create the dataset:

sudo zfs create <pool_name>/directory_name

Here is an example in my system where I have created different datasets for different types of files:

sudo zfs create Swapool/imagessudo ZFS create Swapool/musicsudo ZFS create Swapool/moviessudo ZFS Create swapool/documents sudo zfs create swapool/ebooks

In this way, you will have a very organized structure for your data.

Once you have created all the required datasets, you need to change the file permissions in the pool so that normal system users can write to them.

sudo chown-r user_name:group_name/path_of_poolexample:sudo chown-r swapnil:users/mnt/bank/

All of your configurations are now configured. Start storing your files in the newly created redundant file store. In a subsequent article, I'll cover the periodic maintenance of this store, how to automatically back up the data on the drive, and access the store through the local network, turning it into a file server.

Source: How-to set up a redundant storage pool with ZFS and Ubuntu


License:attribution-noncommercial-noderivatives 4.0 International
This article originates from Suzf Blog. If not noted, are suzf.net original.
Reprint Please specify source: http://suzf.net/thread-0905-1075.html

This article is from the "SUZF blog" blog, please be sure to keep this source http://oceanszf.blog.51cto.com/6268931/1846588

Translation How-to set up a redundant storage pool with ZFS and Ubuntu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.