mirror of
https://github.com/rancher/os.git
synced 2025-09-12 13:17:17 +00:00
import the rancherOS docs so we can write docs for the next release
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
28
docs/os/storage/additional-mounts/index.md
Normal file
28
docs/os/storage/additional-mounts/index.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: Additional Mounts in RancherOS
|
||||
layout: os-default
|
||||
redirect_from:
|
||||
- os/configuration/additional-mounts/
|
||||
---
|
||||
|
||||
## Additional Mounts
|
||||
|
||||
Additional mounts can be specified as part of your [cloud-config]({{site.baseurl}}/os/configuration/#cloud-config). These mounts are applied within the console container. Here's a simple example that mounts `/dev/vdb` to `/mnt/s`.
|
||||
|
||||
```yaml
|
||||
#cloud-config
|
||||
mounts:
|
||||
- ["/dev/vdb", "/mnt/s", "ext4", ""]
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
The four arguments for each mount are the same as those given for [cloud-init](https://cloudinit.readthedocs.io/en/latest/topics/examples.html#adjust-mount-points-mounted). Only the first four arguments are currently supported. The `mount_default_fields` key is not yet implemented.
|
||||
|
||||
RancherOS uses the mount syscall rather than the `mount` command behind the scenes. This means that `auto` cannot be used as the filesystem type (third argument) and `defaults` cannot be used for the options (forth argument).
|
||||
|
||||
### Shared Mounts
|
||||
|
||||
By default, `/media` and `/mnt` are mounted as shared in the console container. This means that mounts within these directories will propogate to the host as well as other system services that mount these folders as shared.
|
||||
|
||||
See [here](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) for a more detailed overview of shared mounts and their properties.
|
28
docs/os/storage/state-partition/index.md
Normal file
28
docs/os/storage/state-partition/index.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: Persistent State Partition in RancherOS
|
||||
layout: os-default
|
||||
---
|
||||
|
||||
## Persistent State Partition
|
||||
|
||||
RancherOS will store its state in a single partition specified by the `dev` field. The field can be a device such as `/dev/sda1` or a logical name such `LABEL=state` or `UUID=123124`. The default value is `LABEL=RANCHER_STATE`. The file system type of that partition can be set to `auto` or a specific file system type such as `ext4`.
|
||||
|
||||
```yaml
|
||||
#cloud-config
|
||||
rancher:
|
||||
state:
|
||||
fstype: auto
|
||||
dev: LABEL=RANCHER_STATE
|
||||
autoformat:
|
||||
- /dev/sda
|
||||
- /dev/vda
|
||||
```
|
||||
|
||||
### Autoformat
|
||||
|
||||
You can specify a list of devices to check to format on boot. If the state partition is already found, RancherOS will not try to auto format a partition. By default, auto-formatting is off.
|
||||
|
||||
RancherOS will autoformat the partition to ext4 if the device specified in `autoformat`:
|
||||
|
||||
* Contains a boot2docker magic string
|
||||
* Starts with 1 megabyte of zeros and `rancher.state.formatzero` is true
|
142
docs/os/storage/using-zfs/index.md
Normal file
142
docs/os/storage/using-zfs/index.md
Normal file
@@ -0,0 +1,142 @@
|
||||
---
|
||||
title: Using ZFS in RancherOS
|
||||
layout: os-default
|
||||
redirect_from:
|
||||
- os/configuration/storage/
|
||||
---
|
||||
|
||||
## Using ZFS
|
||||
|
||||
In order to start using ZFS, you'll need to first enable one of the [persistent consoles]({{site.baseurl}}/os/configuration/custom-console/#console-persistence) and enable [kernel headers]({{site.baseurl}}/os/configuration/kernel-modules-kernel-headers/).
|
||||
|
||||
```
|
||||
$ sudo ros console switch ubuntu
|
||||
$ sudo ros service enable kernel-headers
|
||||
$ sudo ros service up -d kernel-headers
|
||||
```
|
||||
|
||||
When RancherOS console has reloaded, you will have logged into the persistent console. The current kernel headers will need to be downloaded using the `ros service enable` and the service will be started with `ros service up -d kernel-headers`.
|
||||
|
||||
#### Installing ZFS on Ubuntu Console
|
||||
|
||||
Based on the [Ubuntu ZFS docs](https://wiki.ubuntu.com/Kernel/Reference/ZFS), you only need to install `zfs` package into the Ubuntu console to enable ZFS. All the other necessary packages will be installed as its dependencies.
|
||||
|
||||
```
|
||||
$ sudo apt update
|
||||
$ sudo apt install zfs
|
||||
```
|
||||
|
||||
#### Mounting ZFS filesystems on boot
|
||||
|
||||
In order for ZFS to load on boot, it needs to be added to `modules` list in the config. Prior to adding it to the list of modules, you'll need to check to see if there are other modules that are currently enabled.
|
||||
|
||||
```
|
||||
# Check to see what modules currently exist
|
||||
$ sudo ros config get rancher.modules
|
||||
# Make sure to include any modules that were already enabled
|
||||
$ sudo ros config set rancher.modules [zfs]
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
You will also need to have the zpool cache imported on boot:
|
||||
|
||||
```
|
||||
[ -f /etc/zfs/zpool.cache ] && zpool import -c /etc/zfs/zpool.cache -a
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
A cloud-config `runcmd` instruction will do it for you:
|
||||
|
||||
```
|
||||
# check current 'runcmd' list
|
||||
$ sudo ros config get runcmd
|
||||
[]
|
||||
# add the command we need to run on boot
|
||||
$ sudo ros config set runcmd "[[sh, -c, '[ -f /etc/zfs/zpool.cache ] && zpool import -c /etc/zfs/zpool.cache -a']]"
|
||||
```
|
||||
|
||||
#### Using ZFS
|
||||
|
||||
After it's installed, it should be ready to use!
|
||||
|
||||
```
|
||||
$ sudo modprobe zfs
|
||||
$ sudo zpool list
|
||||
$ sudo zpool create zpool1 /dev/<some-disk-dev>
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
To experiment with ZFS, you can create zpool backed by just ordinary files, not necessarily real block devices. In fact, you can mix storage devices in your ZFS pools; it's perfectly fine to create a zpool backed by real devices **and** ordinary files.
|
||||
|
||||
## ZFS storage for Docker on RancherOS
|
||||
|
||||
First, you need to stop the`docker` system service and wipe out `/var/lib/docker` folder:
|
||||
|
||||
```
|
||||
$ sudo system-docker stop docker
|
||||
$ sudo rm -rf /var/lib/docker/*
|
||||
```
|
||||
|
||||
To enable ZFS as the storage driver for Docker, you'll need to create a ZFS filesystem for Docker and make sure it's mounted.
|
||||
|
||||
```
|
||||
$ sudo zfs create zpool1/docker
|
||||
$ sudo zfs list -o name,mountpoint,mounted
|
||||
```
|
||||
|
||||
At this point you'll have a ZFS filesystem created and mounted at `/zpool1/docker`. According to [Docker ZFS storage docs](https://docs.docker.com/engine/userguide/storagedriver/zfs-driver/), if the Docker root dir is a ZFS filesystem, the Docker daemon will automatically use `zfs` as its storage driver.
|
||||
|
||||
Now you'll need to remove `-s overlay` (or any other storage driver) from the Docker daemon args to allow docker to automatically detect `zfs`.
|
||||
|
||||
```
|
||||
$ sudo ros config set rancher.docker.storage_driver ''
|
||||
$ sudo ros config set rancher.docker.graph /zpool1/docker
|
||||
# After editing Docker daemon args, you'll need to start Docker
|
||||
$ sudo system-docker start docker
|
||||
```
|
||||
|
||||
After customizing the Docker daemon arguments and restarting `docker` system service, ZFS will be used as Docker storage driver:
|
||||
|
||||
```
|
||||
$ docker info
|
||||
Containers: 1
|
||||
Running: 0
|
||||
Paused: 0
|
||||
Stopped: 1
|
||||
Images: 1
|
||||
Server Version: 1.12.1
|
||||
Storage Driver: zfs
|
||||
Zpool: zpool1
|
||||
Zpool Health: ONLINE
|
||||
Parent Dataset: zpool1/docker
|
||||
Space Used By Parent: 27761152
|
||||
Space Available: 4100088320
|
||||
Parent Quota: no
|
||||
Compression: off
|
||||
Logging Driver: json-file
|
||||
Cgroup Driver: cgroupfs
|
||||
Plugins:
|
||||
Volume: local
|
||||
Network: host null bridge overlay
|
||||
Swarm: inactive
|
||||
Runtimes: runc
|
||||
Default Runtime: runc
|
||||
Security Options: seccomp
|
||||
Kernel Version: 4.4.16-rancher
|
||||
Operating System: RancherOS v0.6.0-rc8
|
||||
OSType: linux
|
||||
Architecture: x86_64
|
||||
CPUs: 2
|
||||
Total Memory: 1.938 GiB
|
||||
Name: rancher
|
||||
ID: EK7Q:WTBH:33KR:UCRY:YAPI:N7RX:D25K:S7ZH:DRNY:ZJ3J:25XE:P3RF
|
||||
Docker Root Dir: /zpool1/docker
|
||||
Debug Mode (client): false
|
||||
Debug Mode (server): false
|
||||
Registry: https://index.docker.io/v1/
|
||||
Insecure Registries:
|
||||
127.0.0.0/8
|
||||
```
|
Reference in New Issue
Block a user