[mount] Add additional documentation in mount.conf and main.py
This commit is contained in:
parent
a50ffa74e1
commit
bb1d3022e0
@ -58,22 +58,21 @@ def disk_name_for_partition(partition):
|
|||||||
|
|
||||||
|
|
||||||
def is_ssd_disk(partition):
|
def is_ssd_disk(partition):
|
||||||
""" Checks if given disk is actually a ssd disk.
|
""" Checks if given partition is on an ssd disk.
|
||||||
|
|
||||||
:param partition:
|
:param partition: A dict containing the partition information
|
||||||
:return:
|
:return: True is the partition in on an ssd, False otherwise
|
||||||
"""
|
"""
|
||||||
|
|
||||||
disk_name = disk_name_for_partition(partition)
|
try:
|
||||||
filename = os.path.join("/sys/block", disk_name, "queue/rotational")
|
disk_name = disk_name_for_partition(partition)
|
||||||
|
filename = os.path.join("/sys/block", disk_name, "queue/rotational")
|
||||||
|
|
||||||
if not os.path.exists(filename):
|
with open(filename) as sysfile:
|
||||||
# Should not happen unless sysfs changes, but better safe than sorry
|
return sysfile.read() == "0\n"
|
||||||
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
with open(filename) as sysfile:
|
|
||||||
return sysfile.read() == "0\n"
|
|
||||||
|
|
||||||
|
|
||||||
def get_mount_options(filesystem, mount_options, partition):
|
def get_mount_options(filesystem, mount_options, partition):
|
||||||
"""
|
"""
|
||||||
|
@ -5,16 +5,15 @@
|
|||||||
# target as a usable chroot / "live" system). Filesystems are
|
# target as a usable chroot / "live" system). Filesystems are
|
||||||
# automatically mounted from the partitioning module. Filesystems
|
# automatically mounted from the partitioning module. Filesystems
|
||||||
# listed here are **extra**. The filesystems listed in *extraMounts*
|
# listed here are **extra**. The filesystems listed in *extraMounts*
|
||||||
# are mounted in all target systems. The filesystems listed in
|
# are mounted in all target systems.
|
||||||
# *extraMountsEfi* are mounted in the target system **only** if
|
|
||||||
# the host machine uses UEFI.
|
|
||||||
---
|
---
|
||||||
# Extra filesystems to mount. The key's value is a list of entries; each
|
# Extra filesystems to mount. The key's value is a list of entries; each
|
||||||
# entry has four keys:
|
# entry has five keys:
|
||||||
# - device The device node to mount
|
# - device The device node to mount
|
||||||
# - fs (optional) The filesystem type to use
|
# - fs (optional) The filesystem type to use
|
||||||
# - mountPoint Where to mount the filesystem
|
# - mountPoint Where to mount the filesystem
|
||||||
# - options (optional) Extra options to pass to mount(8)
|
# - options (optional) An array of options to pass to mount
|
||||||
|
# - efi (optional) A boolean that when true is only mounted for UEFI installs
|
||||||
#
|
#
|
||||||
# The device is not mounted if the mountPoint is unset or if the fs is
|
# The device is not mounted if the mountPoint is unset or if the fs is
|
||||||
# set to unformatted.
|
# set to unformatted.
|
||||||
@ -47,7 +46,7 @@ extraMounts:
|
|||||||
# It is possible to prevent subvolume creation -- this is likely only relevant
|
# It is possible to prevent subvolume creation -- this is likely only relevant
|
||||||
# for the root (/) subvolume -- by giving an empty string as a subvolume
|
# for the root (/) subvolume -- by giving an empty string as a subvolume
|
||||||
# name. In this case no subvolume will be created.
|
# name. In this case no subvolume will be created.
|
||||||
|
#
|
||||||
btrfsSubvolumes:
|
btrfsSubvolumes:
|
||||||
- mountPoint: /
|
- mountPoint: /
|
||||||
subvolume: /@
|
subvolume: /@
|
||||||
@ -61,17 +60,63 @@ btrfsSubvolumes:
|
|||||||
- mountPoint: /var/log
|
- mountPoint: /var/log
|
||||||
subvolume: /@log
|
subvolume: /@log
|
||||||
|
|
||||||
|
# The name of the btrfs subvolume holding the swapfile. This only used when
|
||||||
|
# a swapfile is selected and the root filesystem is btrfs
|
||||||
|
#
|
||||||
btrfsSwapSubvol: /@swap
|
btrfsSwapSubvol: /@swap
|
||||||
|
|
||||||
|
# The mount options used to mount each filesystem.
|
||||||
|
#
|
||||||
|
# filsystem contains the name of the filesystem or on of three special
|
||||||
|
# values, "default", efi" and "btrfs_swap". The logic is applied in this manner:
|
||||||
|
# - If the partition is the EFI partition, the "efi" entry will be used
|
||||||
|
# - If the fs is btrfs and the subvolume is for the swapfile,
|
||||||
|
# the "btrfs_swap" entry is used
|
||||||
|
# - If the filesystem is an exact match for filesystem, that entry is used
|
||||||
|
# - If no match is found in the above, the default entry is used
|
||||||
|
# - If there is no match and no default entry, "defaults" is used
|
||||||
|
# - If the mountOptions key is not present, "defaults" is used
|
||||||
|
#
|
||||||
|
# Each filesystem entry contains 3 keys, all of which are optional
|
||||||
|
# options - An array of mount options that is used on all disk types
|
||||||
|
# ssdOptions - An array of mount options combined with options for ssds
|
||||||
|
# hddOptions - An array of mount options combined with options for hdds
|
||||||
|
# If combining these options results in an empty array, "defaults" is used
|
||||||
|
#
|
||||||
|
# Example 1
|
||||||
|
# In this example, there are specific options for ext4 and btrfs filesystems,
|
||||||
|
# the EFI partition and the subvolume holding the btrfs swapfile. All other
|
||||||
|
# filesystems use the default entry. For the btrfs filesystem, there are
|
||||||
|
# additional options specific to hdds and ssds
|
||||||
|
#
|
||||||
|
# mountOptions:
|
||||||
|
# - filesystem: default
|
||||||
|
# options: [ defaults ]
|
||||||
|
# - filesystem: efi
|
||||||
|
# options: [ defaults, umask=0077 ]
|
||||||
|
# - filesystem: ext4
|
||||||
|
# options: [ defaults, noatime ]
|
||||||
|
# - filesystem: btrfs
|
||||||
|
# options: [ defaults, noatime, compress=zstd:1 ]
|
||||||
|
# ssdOptions: [ discard=async ]
|
||||||
|
# hddOptions: [ autodefrag ]
|
||||||
|
# - filesystem: btrfs_swap
|
||||||
|
# options: [ defaults, noatime ]
|
||||||
|
#
|
||||||
|
# Example 2
|
||||||
|
# In this example there is a single default used by all filesystems
|
||||||
|
#
|
||||||
|
# mountOptions:
|
||||||
|
# - filesystem: default
|
||||||
|
# options: [ defaults, noatime ]
|
||||||
|
#
|
||||||
mountOptions:
|
mountOptions:
|
||||||
- filesystem: default
|
- filesystem: default
|
||||||
options: [ defaults, noatime ]
|
options: [ defaults, noatime ]
|
||||||
- filesystem: efi
|
- filesystem: efi
|
||||||
options: [ defaults, umask=0077 ]
|
options: [ defaults, umask=0077 ]
|
||||||
- filesystem: btrfs
|
- filesystem: btrfs
|
||||||
options: [ defaults, noatime, compress ]
|
options: [ defaults, noatime, compress=lzo ]
|
||||||
ssdOptions: [ discard=async ]
|
|
||||||
hddOptions: [ autodefrag ]
|
|
||||||
- filesystem: btrfs_swap
|
- filesystem: btrfs_swap
|
||||||
options: [ defaults, noatime ]
|
options: [ defaults, noatime ]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user