Skip to content

Instantly share code, notes, and snippets.

@poddmo
Last active December 4, 2024 00:42
Show Gist options
  • Save poddmo/64fb10b04c9e696bb97cd1653aaeb847 to your computer and use it in GitHub Desktop.
Save poddmo/64fb10b04c9e696bb97cd1653aaeb847 to your computer and use it in GitHub Desktop.
Storage: mdadm and lvm

Raid arrays

Create array

Partition 2TB drives and add to raid6 array

for d in g h i j k ; do echo "/dev/sd${d}" ; sgdisk -n 0:0:3907029134 -t 0:0xfd00  /dev/sd$d ; done
mdadm --create --verbose /dev/md6 --level=6 --chunk=1M --raid-devices=5 /dev/sdg1 /dev/sdh1 /dev/sdi1 /dev/sdj1 /dev/sdk1

Check array

Debian/Ubuntu systems: Run the command /usr/share/mdadm/checkarray -x --all as root. This will cancel all running sync checks.

LVM

EXT4

Mount

Map IDs

mount -v -o X-mount.idmap=b:1000:1002:1,noatime -L store6 /media/store6
mount -v -o X-mount.idmap=u:1000:1002:1,X-mount.idmap=g:1000:1002:1 -L store6 /media/store6

Two different examples to do this: Mount file system labeled store6 to /media/store6. Map both user and group IDs from 1000 found on store6 to the host ID 1002. The range of 1 limits this to a single ID.

systemd

List mount units. Best run after manually mounting all file systems

systemctl list-units --type=mount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment