HON’s Wiki # Linux Server Storage

Home / Linux Servers

Contents

Using Debian, unless otherwise stated.

General

Guidelines and Miscellaneous Notes

SSDs

RAID

System Storage

System Volumes Suggestion

This is just a suggestion for how to partition your main system drive. Since LVM volumes can be expanded later, it’s fine to make them initially small. Create the volumes during system installation and set the mount options later in /etc/fstab.

For a much simpler setup, just use a big root partition with a separate EFI partition. This complex setup is mainly targeted for old-fashioned, “monolithic” servers.

Note: Hidepid is no longer recommended, but still kept here for reference.

Volume/Mount Type Minimal Size (GB) Mount Options
/proc Runtime N/A hidepid=2,gid=1500
/boot/efi FAT32 w/ boot flag (UEFI), none (BIOS) 0.5 nodev,nosuid,noexec
/boot EXT4 (UEFI), FAT32 w/ boot flag (BIOS) 0.5 nodev,nosuid,noexec
Swap Swap (optional) N/A N/A
vg0 LVM 50% or 100% N/A
Swap Swap (LVM) (optional) N/A N/A
/ EXT4 (LVM) 10 nodev
/tmp EXT4 (LVM) 5 nodev,nosuid,noexec
/var EXT4 (LVM) 5 nodev,nosuid
/var/lib EXT4 (LVM) 5 nodev,nosuid
/var/log EXT4 (LVM) 5 nodev,nosuid,noexec
/var/log/audit EXT4 (LVM) 1 nodev,nosuid,noexec
/var/tmp EXT4 (LVM) 5 nodev,nosuid,noexec
/home EXT4 (LVM) 10 nodev,nosuid
/srv EXT4 (LVM) or none if external 10 nodev,nosuid

Disks

Seagate

Attributes 1 (Raw Read Error Rate) and 7 (Seek Error Rate) can be a bit misleading, as a non-zero value does not mean there are errors. They are 48-bit values where the most significant 16 bits are the error count and the lower 32 bits are the number of operations (acting sort of like a fraction/rate).

Applications

SMART

See smartmontools.

For HDDs, the following attributes should stay near 0 and should not be rising. If they are, it may indicate the drive is about to commit seppuku.

Intel SSD Data Center Tool (isdct)

Setup

  1. Download the ZIP for Linux from Intel’s site.
  2. Install the AMD64 deb package.

Usage

Change the Capacity
  1. Remove all partitions from the drive.
  2. Remove all data: isdct delete -intelssd <target>
  3. (Optional) Set the physical sector size: isdct set -intelssd <target> PhysicalSectorSize=<512|4096>
  4. Set the new size: isdct set -intelssd <target> MaximumLBA=<size>
    • If this fails, run isdct set -system EnableLSIAdapter=true. It will add another “version” of the SSDs, which you can try again with.
    • The size can be specified either as “native”, the LBA count, percent (x%) or in gigabytes (xGB). Use “native” unless you have a reason not to.
  5. Prepare it for removal: isdct start -intelssd <target> -standby
  6. Reconnect the drives or restart the system.

Volume Managers, File Systems, Etc.

Autofs

Autofs automatically mounts directories when accessed and unmounts them after a period of inactivity. Note that ls will not reveal an unmounted autofs mount. To automount it, you need to actually enter it (or equivalent).

Setup

  1. Install: apt install autofs
  2. Configure master map config:
    • File: /etc/auto.master
    • Each line declares a direct or indirect map, which consists of a path and a set of mounts in a separate configuration file. Indirect maps mount the mountpoints inside the path in the master config, while direct maps (specified using path /- in the master config) mount the mountpoints using absolute paths.
    • Map line format: <mountpoint> [options] <mapfile> [options]
  3. Configure map configs:
    • File path convention: /etc/auto.<id> (matching entry in master map config)
    • Mount line format: <mountpoint> [options] <location>
    • The location may e.g. be an NFS export.
  4. (Optional) Automount home dirs or similar using wildcards:
    • As specifying all dirs would be cumbersome, wildcards may be used instead.
    • Add /home /etc/auto.home to the master map.
    • Add * <server>:/home/& to the home map (using NFS).
  5. (Optional) Run in foreground for debugging:
    • Stop the daemon: sudo service autofs stop
    • Run in foreground: sudo automount -f -v
    • Test stuff in other terminal.

LUKS

Setup

  1. Install: apt install cryptsetup

Usage

Encrypt Normal Partition
  1. Format the device/partition: cryptsetup -v luksFormat <dev> [keyfile]
    • If not keyfile is specified, a password is required instead.
    • Generate random keyfile: dd if=/dev/random of=/root/.credentials/luks/<dev> bs=64 count=1
  2. (Optional) Add extra keys: cryptsetup luksAddKey <dev> [--key-file <oldkeyfile>] [keyfile]
    • Specify oldkeyfile to unlock it using a existing keyfile.
    • Omit keyfile to add a password.
  3. (Optional) Check the result: cryptsetup luksDump <dev>
  4. Mount the decrypted device: cryptsetup open <dev> [--key-file <keyfile>] <name>
    • Close: cryptsetup close <name>
    • Show status: cryptsetup -v status <name>
  5. (Optional) Zeroize it to write random data to disk: dd if=/dev/zero of=<mapper-dev> status=progress
  6. Format using some file system: mkfs.ext4 <mapper-dev> (for EXT4)
  7. (Optional) Permanently mount device and FS using keyfile:
    1. In /etc/crypttab, add: <name> UUID=<dev-uuid> <keyfile> luks
    2. In /etc/fstab, add: /dev/mapper/<name> <mountpoint> ext4 defaults 0 0 (for EXT4)
    3. Reload /etc/crypttab: systemctl reload-daemons
    4. Reload /etc/fstab: mount -a

Ceph

See Linux Server Storage: Ceph.

ZFS

See Linux Server Storage: ZFS.

Miscellanea


hon.one | HON95/wiki | Edit page