mc files export add
Create an export, and let AIStor assign it to a node.
mc files export add creates an export. AIStor assigns the export to a node, sends that
node its configuration, and waits for the node to take it.
Syntax
mc files export add ALIAS EXPORT --pseudo PATH [FLAGS]EXPORT is the new export's name. See Names and IDs.
Flags
| Flag | Meaning |
|---|---|
--pseudo PATH | Required. The path clients mount. It must be / followed by the export's name, such as /carol. |
--size SIZE | The byte limit, such as 10GiB. The default is none (or unlimited), which sets no limit. |
--access MODE | The access every client gets while the export has no access rules: rw, ro, or none. Default rw. |
--squash MODE | How the export maps a client's users: root, none, or all. Default root. |
--root-dir-uid UID | The user that owns the export root. Required with --squash root. See The export root. |
--root-dir-gid GID | The group of the export root. Required with --squash root. |
--root-dir-mode MODE | The export root's permission bits, in octal. Default 0755. |
--anon-uid UID | The user a squashed user becomes. Default 65534. |
--anon-gid GID | The group a squashed user becomes. Default 65534. |
--node NODE | The node that reports the export's status. Every node serves the export. By default, AIStor chooses the node that holds the fewest exports. |
--export-id N | Sets the export's numeric ID, from 1 to 59999. By default, AIStor assigns it. |
After add, you can change only the access rules, with access,
and the byte limit, with quota. Every other setting keeps the value
you gave at add. For the units --size takes, see
Sizes.
--access
--access applies only while the export has no access rules. Once it has a rule, a client
that matches no rule is denied. Use --access none to keep a new export closed until you
set its rules.
--squash
--squash applies to every client of the export, whatever access rule it matched. It maps
some of a client's users to the anonymous user. --anon-uid and --anon-gid set the
anonymous user. The default, 65534, is nobody on most Linux clients.
| Value | Root on a client | Any other user | New files belong to |
|---|---|---|---|
root (default) | Becomes the anonymous user. It cannot chown or override modes. | Keeps its own uid and gid. Group 0 is squashed. | The user's uid and gid, after squashing |
all | Becomes the anonymous user. | Becomes the anonymous user. | The anonymous user |
none | Stays root. It can chown, chmod, and read or write any file. | Keeps its own uid and gid. | The user's uid and gid |
Under root and all, a squashed user also loses its supplementary groups.
Under root, choose an anonymous uid that no client user has. Root on a client becomes
that user, and can change every file that user owns.
The export root
The export root is the directory a client sees at the mount point. Under root and
all, no client can chown it. So add sets its owner, and each squash takes different
flags:
| Squash | --root-dir-uid, --root-dir-gid | --anon-uid, --anon-gid |
|---|---|---|
root | Required. Neither can be 0, because no client acts as 0 under root. | Optional, default 65534. Neither can be 0. |
all | Refused. The anonymous user owns the export root. | Optional, default 65534. Neither can be 0. |
none | Optional, default 0. Root on a client can chown the export root. | Refused. No user is squashed. |
--root-dir-mode sets the export root's permission bits under every squash. It is at
most 07777. For example:
| Mode | Who can create entries at the top of the export |
|---|---|
0755 | The owner only. The default. |
0700 | The owner only. Other users cannot list the export either. |
02775 | The owner and members of the export root's group. |
01777 | Every user. Only an entry's owner, or the export root's owner, can delete or rename it. |
User and group IDs are numbers, as the clients see them. Run id -u and id -g on a
client to get a user's IDs.
These values apply only when the export is created. After that the export root is an
ordinary directory. Its owner can chmod it, and chgrp it to a group the owner is in.
Under none, root on a client can also chown it. info shows the
values you gave at add. ls -ld on a mount shows the current ones.
So a writable export under each squash looks like this:
# root: uid 1001 owns the export root
mc files export add myaistor carol --pseudo /carol \
--root-dir-uid 1001 --root-dir-gid 1001
# root: uid 1001 and the members of group 3000 share the export root
mc files export add myaistor eng --pseudo /eng \
--root-dir-uid 1001 --root-dir-gid 3000 --root-dir-mode 02775
# all: every user is uid 2000, which owns the export root
mc files export add myaistor scratch --pseudo /scratch --squash all \
--anon-uid 2000 --anon-gid 2000
# none: the export root is 0:0 0755, and root on a trusted client sets it up
mc files export add myaistor backup --pseudo /backup --squash none --access noneUnder --squash none, root on every allowed client is root on the export. So use
--access none with it, and allow only trusted clients with access.
--node
NODE is the node's host name without the port, such as node03.example.com for the
server node03.example.com:9000. The NODE column of list shows
nodes in this form. A short name such as node03 is refused.
A node can take an export when its gateway answers and its first drive is online. The
first drive holds the gateway's state. AIStor refuses a NODE that cannot take an export.
Without --node, AIStor chooses only among the nodes that can.
--export-id
An ID that any export has used is refused, including the ID of a removed export. IDs from 60000 up are reserved.
What happens
add waits for the node, and reports one of these results:
| Result | Meaning |
|---|---|
serving | The node took the export and serves it. |
pending | AIStor recorded the export, and the node has not yet confirmed it. list shows the change. |
| An error | Usually, the node refused the export or no node could take it, and AIStor recorded nothing. |
When mc reports instead that the add may have created the export, the outcome is
unknown. Check with mc files export info ALIAS EXPORT before you add it again.
Examples
Add a 10 GiB export that the client user with uid and gid 1001 owns, and let AIStor
choose the node. --access none keeps the export closed until a rule allows a client:
mc files export add myaistor carol --pseudo /carol --size 10GiB --access none \
--root-dir-uid 1001 --root-dir-gid 1001Added export `carol`
Export id 104
Node node03.example.com
Status serving
Pseudo path /carol
Access mode none
Squash root
Anonymous 65534:65534
Root at add 1001:1001 0755
Quota 10 GiBThe output shows every value add used, defaults included. Allow the client 192.0.2.7
read-write:
echo '192.0.2.7 rw' | mc files export access myaistor carol -f -Add an export without a limit on a chosen node:
mc files export add myaistor archive --pseudo /archive --node node03.example.com \
--root-dir-uid 1500 --root-dir-gid 1500