Skip to content

Commit

Permalink
Add HW4-zfs/POOLSETTINGS.md. Some small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vscoder committed Jun 3, 2020
1 parent 45dbaa8 commit 6c19384
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 3 deletions.
167 changes: 167 additions & 0 deletions HW4-zfs/POOLSETTINGS.md
@@ -0,0 +1,167 @@
# Determine pool settings

All actions executed on clean VM

## Prepare

Install zfs (run on host)
```shell
cat install.sh | vagrant ssh -c "bash"
```

## Get disk image with zfs

Fetch and extract disk image (download link is modified to download image with `wget` command)
```shell
cd ~
wget -O zfsdisk.img.tar.gz "https://drive.google.com/u/0/uc?id=1KRBNW33QWqbvbVHa3hLJivOAt60yukkg&export=download"
tar xvzf zfsdisk.img.tar.gz
```
```log
zpoolexport/
zpoolexport/filea
zpoolexport/fileb
```

A content of the archive
```shell
cd ~/zpoolexport
ls -l
```
```log
total 1024000
-rw-r--r-- 1 vagrant vagrant 524288000 May 15 05:00 filea
-rw-r--r-- 1 vagrant vagrant 524288000 May 15 05:00 fileb
```

List available pools
```shell
sudo zpool import -d ~/zpoolexport
```
```log
pool: otus
id: 6554193320433390805
state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:
otus ONLINE
mirror-0 ONLINE
/home/vagrant/zpoolexport/filea ONLINE
/home/vagrant/zpoolexport/fileb ONLINE
```

## Mount zfs

Import pool
```shell
sudo zpool import -d ~/zpoolexport otus
sudo zpool list
```
```log
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
otus 480M 2.18M 478M - - 0% 0% 1.00x ONLINE -
```

Check content
```shell
tree /otus
```
<details><summary>output</summary>
<p>

```log
/otus/
└── hometask2
├── dir1
│ ├── dir101
│ ├── dir1010
│ ├── dir102
│ ├── dir103
│ ├── dir104
│ ├── dir105
│ ├── dir106
...
├── dir92
├── dir93
├── dir94
├── dir95
├── dir96
├── dir97
├── dir98
└── dir99
17537 directories, 0 files
```
</p>
</details>

## Analize

Pool size (`480M`)
```shell
zpool get size otus
NAME PROPERTY VALUE SOURCE
otus size 480M -
```

ZFS Size (`350M`)
```shell
sudo zfs list
```
```log
NAME USED AVAIL REFER MOUNTPOINT
otus 1.99M 350M 24K /otus
otus/hometask2 1.80M 350M 1.80M /otus/hometask2
```

Pool type (`mirror`)
```shell
zpool status
```
```log
pool: otus
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
otus ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
/home/vagrant/zpoolexport/filea ONLINE 0 0 0
/home/vagrant/zpoolexport/fileb ONLINE 0 0 0
errors: No known data errors
```

Recordsize (`128K`)
```shell
zfs get recordsize
```
```log
NAME PROPERTY VALUE SOURCE
otus recordsize 128K local
otus/hometask2 recordsize 128K inherited from otus
```

Compression type (`zle`)
```shell
zfs get compression
```
```log
NAME PROPERTY VALUE SOURCE
otus compression zle local
otus/hometask2 compression zle inherited from otus
```

Checksum algorithm (`sha256`)
```shell
zfs get checksum
```
```log
NAME PROPERTY VALUE SOURCE
otus checksum sha256 local
otus/hometask2 checksum sha256 inherited from otus
```

**Settings description** is available in `man 8 zfs` and `man 8 zpool`
4 changes: 4 additions & 0 deletions HW4-zfs/README.md
Expand Up @@ -3,3 +3,7 @@
## The best compression algorithm

[COMPRESSION.md](./COMPRESSION.md)

## Determine pool settings

[POOLSETTINGS.md][./POOLSETTINGS.md]
3 changes: 0 additions & 3 deletions HW4-zfs/create.sh
Expand Up @@ -2,9 +2,6 @@

set -ex

echo Ensure module is mounted
sudo /sbin/modprobe zfs

echo Create zfs pool named zpool with cache
sudo zpool create zpool sdb cache sdc
sudo zpool status
Expand Down
3 changes: 3 additions & 0 deletions HW4-zfs/install.sh
Expand Up @@ -10,3 +10,6 @@ sudo gpg --quiet --with-fingerprint /etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux

echo "Install (it can take a long time on weak machine)"
sudo yum install -y zfs

echo "Ensure zfs kernel module is mounted"
sudo /sbin/modprobe zfs
12 changes: 12 additions & 0 deletions HW4-zfs/pool.sh
@@ -0,0 +1,12 @@
#!/bin/bash

echo Fetch and extract disk image
cd ~
test -f zfsdisk.img.tar.gz || wget -O zfsdisk.img.tar.gz https://drive.google.com/u/0/uc?id=1KRBNW33QWqbvbVHa3hLJivOAt60yukkg&export=download
ls -lah zfsdisk.img.tar.gz
tar xvzf zfsdisk.img.tar.gz

echo "Import zpool from files"
sudo zpool import -d ~/zpoolexport otus
sudo zpool list

0 comments on commit 6c19384

Please sign in to comment.