|
1 |
| -<h1 align="center">xfsvol 📂 </h1> |
2 |
| - |
3 |
| -<h5 align="center">Docker Volume Plugin for managing local XFS-based volumes</h5> |
4 |
| - |
5 |
| -<br/> |
6 |
| - |
7 |
| -[](https://travis-ci.org/cirocosta/xfsvol) |
8 |
| - |
9 |
| -## Quickstart |
10 |
| - |
11 |
| -1. Create a mountpoint at `/mnt/xfs` and a directory `/mnt/xfs/volumes`. |
12 |
| - |
13 |
| -For testing purposes this mountpoint can be a loopback device (note: use a loopback device for testing purposes only). |
14 |
| - |
15 |
| -```sh |
16 |
| -sudo dd if=/dev/zero of=/xfs.1G bs=1M count=1024 |
17 |
| -sudo losetup /dev/loop0 /xfs.1G |
18 |
| -sudo mkfs -t xfs -n ftype=1 /dev/loop0 |
19 |
| -sudo mkdir -p /mnt/xfs/volumes |
20 |
| -sudo mount /dev/loop0 /mnt/xfs -o pquota |
21 |
| -``` |
22 |
| - |
23 |
| -2. Install the plugin |
24 |
| - |
25 |
| -``` |
26 |
| -docker plugin install \ |
27 |
| - --grant-all-permissions \ |
28 |
| - --alias xfsvol \ |
29 |
| - cirocosta/xfsvol |
30 |
| -
|
31 |
| -docker plugin ls |
32 |
| -ID NAME DESCRIPTION ENABLED |
33 |
| -06545b643c6a xfsvol:latest Docker plugin to manage XFS-mounted volumes true |
34 |
| -``` |
35 |
| - |
36 |
| -3. Create a named volume |
37 |
| - |
38 |
| -``` |
39 |
| -docker volume create \ |
40 |
| - --driver xfsvol \ |
41 |
| - --opt size=10M \ |
42 |
| - myvolume1 |
43 |
| -``` |
44 |
| - |
45 |
| -4. Run a container with the volume attached |
46 |
| - |
47 |
| -``` |
48 |
| -docker run -it \ |
49 |
| - -v myvolume1:/myvolume1 \ |
50 |
| - alpine /bin/sh |
51 |
| -
|
52 |
| -dd if=/dev/zero of=/myvolume1/file bs=1M count=100 |
53 |
| -(fail!) |
54 |
| -``` |
55 |
| - |
56 |
| -5. Check the volumes list |
57 |
| - |
58 |
| -``` |
59 |
| -docker volume ls |
60 |
| -DRIVER VOLUME NAME |
61 |
| -xfsvol:latest myvolume1 (1.004MB) |
62 |
| -local dockerdev-go-pkg-cache-gopath |
63 |
| -local dockerdev-go-pkg-cache-goroot-linux_amd64 |
64 |
| -local dockerdev-go-pkg-cache-goroot-linux_amd64_netgo |
65 |
| -``` |
66 |
| - |
67 |
| -and the `xfsvolctl` utility: |
68 |
| - |
69 |
| -``` |
70 |
| -sudo /usr/bin/xfsvolctl ls --root /mnt/xfs/volumes/ |
71 |
| -NAME QUOTA |
72 |
| -ciro 1.004 MB |
73 |
| -``` |
74 |
| - |
75 |
| -## `xfsvolctl` |
76 |
| - |
77 |
| -This tool is made to help inspect the project quotas created under a given root path as well as create/delete others. It's usage is documented under `--help`: |
78 |
| - |
79 |
| -``` |
80 |
| -xfsvolctl --help |
81 |
| -NAME: |
82 |
| - xfsvolctl - Controls the 'xfsvol' volume plugin |
83 |
| -
|
84 |
| -USAGE: |
85 |
| - xfsvolctl [global options] command [command options] [arguments...] |
86 |
| -
|
87 |
| -VERSION: |
88 |
| - 0.0.0 |
89 |
| -
|
90 |
| -COMMANDS: |
91 |
| - ls Lists the volumes managed by 'xfsvol' plugin |
92 |
| - create Creates a volume with XFS project quota enforcement |
93 |
| - delete Deletes a volume managed by 'xfsvol' plugin |
94 |
| - help, h Shows a list of commands or help for one command |
95 |
| -
|
96 |
| -GLOBAL OPTIONS: |
97 |
| - --help, -h show help |
98 |
| - --version, -v print the version |
99 |
| -``` |
100 |
| - |
101 |
| -### Under the hood |
102 |
| - |
103 |
| - |
104 |
| -``` |
105 |
| -$ sudo mkdir -p /mnt/xfs/tmp/bbb |
106 |
| -$ sudo strace -f xfsvolctl create \ |
107 |
| - --root /mnt/xfs/tmp/bbb \ |
108 |
| - --name ccc \ |
109 |
| - --size 1024 \ |
110 |
| - --inode 1024 |
111 |
| -
|
112 |
| -stat("/mnt/xfs/tmp/bbb", {st_mode=S_IFDIR|0755, st_size=6, ...}) = 0 |
113 |
| -unlinkat(AT_FDCWD, "/mnt/xfs/tmp/bbb/backingFsBlockDev", 0) = -1 ENOENT (No such file or directory) |
114 |
| -mknodat(AT_FDCWD, "/mnt/xfs/tmp/bbb/backingFsBlockDev", S_IFBLK|0600, makedev(7, 0)) = 0 |
115 |
| -quotactl(Q_XSETQLIM|PRJQUOTA, "/mnt/xfs/tmp/bbb/backingFsBlockDev", 1, {version=1, flags=XFS_PROJ_QUOTA, fieldmask=0xc, id=1, blk_hardlimit=0, blk_softlimit=0, ino_hardlimit=0, ino_softlimit=0, bcount=0, icount=0, ...}) = 0 |
116 |
| -... |
117 |
| -mkdirat(AT_FDCWD, "/mnt/xfs/tmp/bbb/ccc", 0755) = 0 |
118 |
| -open("/mnt/xfs/tmp/bbb/ccc", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 |
119 |
| -fstat(3, {st_mode=S_IFDIR|0755, st_size=6, ...}) = 0 |
120 |
| -ioctl(3, FS_IOC_FSGETXATTR, 0xc4201a95e4) = 0 |
121 |
| -ioctl(3, FS_IOC_FSSETXATTR, 0xc4201a95e4) = 0 |
122 |
| -
|
123 |
| -quotactl(Q_XSETQLIM|PRJQUOTA, "/mnt/xfs/tmp/bbb/backingFsBlockDev", 2, {version=1, flags=XFS_PROJ_QUOTA, fieldmask=0xc, id=2, blk_hardlimit=2, blk_softlimit=2, ino_hardlimit=1024, ino_softlimit=1024, bcount=0, icount=0, ...}) = 0 |
124 |
| -[pid 6833] ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0 |
125 |
| -
|
126 |
| -
|
127 |
| -// retrieving (ls) |
128 |
| -
|
129 |
| -[pid 8609] quotactl(Q_XGETQUOTA|PRJQUOTA, "/mnt/xfs/tmp/ddd/backingFsBlockDev", 2, {version=1, flags=XFS_PROJ_QUOTA, fieldmask=0, id=2, blk_hardlimit=8, blk_softlimit=8, ino_hardlimit=0, ino_softlimit=0, bcount=8, icount=104, ...}) = 0 |
130 |
| -
|
131 |
| -
|
132 |
| -``` |
| 1 | +# Performance |
| 2 | +https://serverfault.com/questions/166748/performance-of-loopback-filesystems |
| 3 | +https://kernelnewbies.org/Linux_4.4#Faster_and_leaner_loop_device_with_Direct_I.2FO_and_Asynchronous_I.2FO_support |
133 | 4 |
|
| 5 | +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bc07c10a3603a5ab3ef01ba42b3d41f9ac63d1b6 |
0 commit comments