|
| 1 | +Description |
| 2 | +=========== |
| 3 | + |
| 4 | +This cookbook exists to generically define and create block device filesystems with the minimum of inputs. |
| 5 | + |
| 6 | +This cookbook supports four main types of block devices: |
| 7 | + |
| 8 | +* normal `device` - drives, ssds, volumes presented by HBAs etc |
| 9 | +* device ID `uuid` - mostly found on drives / known block IDs. |
| 10 | +* LVM Volume Groups `vg` - found on systems using LVM. |
| 11 | +* file-backed `file` - created dynamically and looped back - will not come up on reboot, but we will try to remount existing `file` storage in chef. |
| 12 | + |
| 13 | +We will try to create filesystems in two ways: through keys found in node data under 'filesystems' or by being called directly with the `filesystem` default provider. See the example recipe. |
| 14 | + |
| 15 | +You can also use your own key for a list of filesystems, see the example recipe for an example of this option. |
| 16 | + |
| 17 | +Tools have been listed in the following attribute key : filesystem_tools. This allows for extending the support to other/new filesystems. |
| 18 | + |
| 19 | +Requirements |
| 20 | +============ |
| 21 | + |
| 22 | +* lvm cookbook when creating logical volumes |
| 23 | +* package #{fstype}progs to support your chosen fstype. We provide some defaults, too. |
| 24 | + |
| 25 | +Main Attributes |
| 26 | +=============== |
| 27 | + |
| 28 | +##### `filesystems` |
| 29 | +Hash of filesytems to setup - this is called filesystems because filesystem is already created/managed by ohai (i.e. no s on the end). |
| 30 | +##### `node[:filesystems]` keys: |
| 31 | +Each filesytem's key is the FS `label`: This explains each key in a filesystems entry. The label must not exceed 12 characters. |
| 32 | + |
| 33 | +We also let you use your own top-level key if you want - see the default recipe and example recipe. |
| 34 | + |
| 35 | +Filesystem Backing Location keys |
| 36 | +================================ |
| 37 | + |
| 38 | +##### `device` |
| 39 | +Path to the device to create the filesystem upon. |
| 40 | +##### `uuid` |
| 41 | +UUID of the device to create the filesystem upon. |
| 42 | +##### `file` |
| 43 | +Path to the file-backed storage to be used for a loopback device. `device` must also be present to specify the loopback. If the `file` is not present it will be created, as long as a size is given. |
| 44 | +##### `vg` |
| 45 | +Name of the LVM volume group use as backing store for a logical volume. If not present it will be created, as long as a size is given. |
| 46 | + |
| 47 | +Each filesystem should be given one of these attributes for it to have a location to be created at. |
| 48 | + |
| 49 | +If none of these are present then we try to find a device at the label itself. |
| 50 | + |
| 51 | +Filesystem Creation Options |
| 52 | +=========================== |
| 53 | + |
| 54 | +##### `fstype` [ocfs2|ext3|ext4|etc] (default: ext3) |
| 55 | +The type of filesystem to be created. |
| 56 | +##### `mkfs_options` unique for each filesystem. |
| 57 | +Options to pass to mkfs at creation time. |
| 58 | + |
| 59 | +Filesystem Backing Options |
| 60 | +========================== |
| 61 | + |
| 62 | +##### `size` 10000 (`file`) or 10%VG|10g (`vg`) |
| 63 | +The size, only used for filesystems backed by `vg` and `file` storage. If vg then a number suffixied by the scale [g|m|t|p], if a file then just a number [megabytes]. |
| 64 | +##### `sparse` Boolean (default: true) |
| 65 | +Sparse file creation, used by the `file` storage, by default we use this for speed, but you may not want that. |
| 66 | +##### `stripes` optional. |
| 67 | +The stripes, only used for filesystems backed by `vg` aka LVM storage. |
| 68 | +##### `mirrors` optional. |
| 69 | +The mirrors, only used for filesystems backed by `vg` aka LVM storage. |
| 70 | + |
| 71 | +Filesystem Mounting Options |
| 72 | +=========================== |
| 73 | + |
| 74 | +##### `mount` /path/to/mount |
| 75 | +Path to mount the filesystem. (If present we will mount the filesystem - this is rather important) |
| 76 | +##### `options` rw,noatime,defaults (default: defaults) |
| 77 | +Options to mount with and add to the fstab. |
| 78 | +##### `dump` 0|1|2 (default: 0) |
| 79 | +Dump entry for fstab |
| 80 | +##### `pass` 0|1|2 (default: 0) |
| 81 | +Pass entry for fstab |
| 82 | +##### `user` name |
| 83 | +Owner of the mountpoint, otherwise we use the chef default. We will not try to create users. You should use the users cookbook for that. |
| 84 | +##### `group` name |
| 85 | +Group of the mountpoint, otherwise we use the chef default. We will not try to create groups. You should write a cookbook to make them nicely. |
| 86 | +##### `mode` 775 |
| 87 | +Mode of the mountpoint, otherwise we use the chef default. |
| 88 | + |
| 89 | +Package and Recipe Options |
| 90 | +========================== |
| 91 | + |
| 92 | +##### `package` Package name to install, if specified. |
| 93 | +Used to support the filesystem |
| 94 | +##### `recipe` Recipe to run, if specified - for future use, not currently supported from the lwrp. |
| 95 | +Used to support the filesystem |
| 96 | + |
| 97 | +Atypical Behaviour Modifiers |
| 98 | +============================ |
| 99 | + |
| 100 | +##### `force` Boolean (default: false) |
| 101 | +Set to true we unsafely create filesystems even if they already exist. If there is data it will be lost. Should not use this unless you are quite confident. |
| 102 | +##### `nomkfs` Boolean (default: false) |
| 103 | +Set to true to disable creation of the filesystem. |
| 104 | +##### `nomount` Boolean (default: false) |
| 105 | +Set to true to disable mounting of the filesystem. |
| 106 | +##### `noenable` Boolean (default: false) |
| 107 | +Set to true to disable adding to fstab. |
| 108 | + |
| 109 | +Usage |
| 110 | +===== |
| 111 | + |
| 112 | +Keyed filesystem creation: |
| 113 | + |
| 114 | +````JSON |
| 115 | +{ |
| 116 | + "filesystems": { |
| 117 | + "testfs1": { |
| 118 | + "device": "/dev/sdb", |
| 119 | + "mount": "/db", |
| 120 | + "fstype": "xfs", |
| 121 | + "optons": "noatime,nobarrier", |
| 122 | + "mkfs_options": "-d sunit=128,swidth=2048" |
| 123 | + }, |
| 124 | + "applv1": { |
| 125 | + "mount": "/logical1", |
| 126 | + "fstype": "ext4", |
| 127 | + "vg": "standardvg", |
| 128 | + "size": "20G" |
| 129 | + }, |
| 130 | + "cluster_01": { |
| 131 | + "fstype": "ocfs2", |
| 132 | + "package": "ocfs2-tools", |
| 133 | + "device": "/dev/mpath/ocfs01", |
| 134 | + "mount": "/mnt/test" |
| 135 | + }, |
| 136 | + "filebacked": { |
| 137 | + "file": "/mnt/filesystem-on-a-filesystem.file", |
| 138 | + "device": "/dev/loop7", |
| 139 | + "mount": "/mnt/filesystem-on-a-filesystem", |
| 140 | + "size": "20000" |
| 141 | + } |
| 142 | + } |
| 143 | +} |
| 144 | +```` |
| 145 | + |
| 146 | +Direct LWRP'd creation: |
| 147 | + |
| 148 | +````RUBY |
| 149 | +filesystem "label" do |
| 150 | + fstype "ext3" |
| 151 | + device "/dev/sdb1" |
| 152 | + mount "/mnt/littlelabel" |
| 153 | + action [:create, :enable, :mount] |
| 154 | +end |
| 155 | +```` |
| 156 | + |
| 157 | +Links |
| 158 | +===== |
| 159 | + |
| 160 | +Development is at https://github.com/atrullmdsol/filesystem_cookbook |
| 161 | +Opscode community page is at http://community.opscode.com/cookbooks/filesystem |
| 162 | + |
| 163 | +Authors |
| 164 | +======= |
| 165 | + |
| 166 | +* Alex Trull <cookbooks.atrullmdsol@trull.org> |
| 167 | +* Jesse Nelson <spheromak@gmail.com> source of the original cookbook. |
0 commit comments