This cookbook exists to generically define and create block device filesystems with the minimum of inputs.
This cookbook supports four main types of block devices:
- normal
device
- drives, ssds, volumes presented by HBAs etc - device ID
uuid
- mostly found on drives / known block IDs. - LVM Volume Groups
vg
- found on systems using LVM. - file-backed
file
- created dynamically and looped back.
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.
You can also use your own key for a list of filesystems, see the example recipe for an example of this option.
Tools have been listed in the following attribute key : filesystem_tools. This allows for extending the support to other/new filesystems.
- lvm cookbook when creating logical volumes
- package #{fstype}progs to support your chosen fstype. We provide some defaults, too.
Hash of filesytems to setup - this is called filesystems because filesystem is already created/managed by ohai (i.e. no s on the end).
Each filesytem's key is the FS label
: This explains each key in a filesystems entry. The label must not exceed 12 characters.
We also let you use your own top-level key if you want - see the default recipe and example recipe.
Path to the device to create the filesystem upon.
UUID of the device to create the filesystem upon.
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.
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.
Each filesystem should be given one of these attributes for it to have a location to be created at.
If none of these are present then we try to find a device at the label itself.
The type of filesystem to be created.
Options to pass to mkfs at creation time.
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].
Sparse file creation, used by the file
storage, by default we use this for speed, but you may not want that.
The stripes, only used for filesystems backed by vg
aka LVM storage.
The mirrors, only used for filesystems backed by vg
aka LVM storage.
Path to mount the filesystem. (If present we will mount the filesystem - this is rather important)
Options to mount with and add to the fstab.
Dump entry for fstab
Pass entry for fstab
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.
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.
Mode of the mountpoint, otherwise we use the chef default.
Used to support the filesystem
Used to support the filesystem
Set to true we unsafely create filesystems. If there is data it will be lost. Should not use this unless you are quite confident.
Set to true we will ignore existing filesystems and recreate them. Double Dangerous and only for unsound behaviour. Use with 'force' true.
Set to true to disable creation of the filesystem.
Set to true to disable mounting of the filesystem.
Set to true to disable adding to fstab.
Keyed filesystem creation:
{
"filesystems": {
"testfs1": {
"device": "/dev/sdb",
"mount": "/db",
"fstype": "xfs",
"options": "noatime,nobarrier",
"mkfs_options": "-d sunit=128,swidth=2048"
},
"testswap1": {
"device": "/dev/sdc",
"mount": "none",
"fstype": "linux-swap"
},
"applv1": {
"mount": "/logical1",
"fstype": "ext4",
"vg": "standardvg",
"size": "20G"
},
"cluster_01": {
"fstype": "ocfs2",
"package": "ocfs2-tools",
"device": "/dev/mpath/ocfs01",
"mount": "/mnt/test"
},
"filebacked": {
"file": "/mnt/filesystem-on-a-filesystem.file",
"device": "/dev/loop7",
"mount": "/mnt/filesystem-on-a-filesystem",
"size": "20000"
}
}
}
Direct LWRP'd creation:
filesystem "label" do
fstype "ext3"
device "/dev/sdb1"
mount "/mnt/littlelabel"
action [:create, :enable, :mount]
end
Development is at https://github.com/atrullmdsol/filesystem_cookbook Opscode community page is at http://community.opscode.com/cookbooks/filesystem
- Alex Trull [email protected]
- Jesse Nelson [email protected] source of the original cookbook.