November 18

Linux: LUKS setup on a Linux mdadm raid setup

cryptsetup luksFormat /dev/md0
cryptsetup isLuks /dev/md0 && echo Success
cryptsetup luksDump /dev/md0
cryptsetup luksUUID /dev/md0
cryptsetup luksOpen /dev/md0 422d7f7c-2d98-48df-abe5-239def725f18
dmsetup info 422d7f7c-2d98-48df-abe5-239def725f18
ls /dev/mapper/

Setup auto login from the gui.

-------------------------------------------------------------------------
If using the command line you can do the following:
Create a key to unlock the volume
dd if=/dev/urandom of=/etc/luks-keys/disk_secret_key bs=512 count=8

cryptsetup -v luksAddKey /dev/md0 /etc/luks-keys/disk_secret_key
Enter any passphrase: passphrase
Key slot 0 unlocked.
Command successful.

cryptsetup luksDump /dev/md0 | grep "Key Slot"

cryptsetup -v luksOpen /dev/md0 md0_crypt --key-file=/etc/luks-keys/disk_secret_key
Key slot 1 unlocked.
Command successful.

cryptsetup -v luksClose md0_crypt
Command successful.

cryptsetup luksDump /dev/md0 | grep "UUID"
UUID:          	2a5588ce-2262-413c-a6a8-fcbc65847c85

Edit the /etc/crypttab
md0_crypt UUID=2a5588ce-2262-413c-a6a8-fcbc65847c85 /etc/luks-keys/disk_secret_key luks 

cat /etc/crypttab
luks-422d7f7c-2d98-48df-abe5-239def725f18 UUID=422d7f7c-2d98-48df-abe5-239def725f18 /etc/luks-keys/disk_secret_key nofail

Verify
cryptdisks_start md0_crypt
Category: Linux | Comments Off on Linux: LUKS setup on a Linux mdadm raid setup
November 18

Linux: mdadm setup

mdadm –create /dev/md0 –level=5 –raid-devices=4 /dev/sdb /dev/sdc /dev/sdd /dev/sde
mdadm –verbose –detail -scan > /etc/mdadm.conf
fdisk -l

Category: Linux | Comments Off on Linux: mdadm setup
November 18

Linux: NFSv4 Setup

yum install nfs-utils nfs-utils-lib nfs4-acl-tools

echo ‘RPCNFSDARGS=”-N 2 -N 3 -U”‘ >> /etc/sysconfig/nfs

chkconfig nfs on

service nfs start

/etc/exports
/ 192.168.1.0/24(ro,fsid=0)
/mnt/backup 192.168.1.0/24(rw,async,nohide,no_root_squash)

exportfs -rv
exportfs -e

test nfs connection
mount -t nfs4 targetserver:/directory /localdirectory

Category: Linux | Comments Off on Linux: NFSv4 Setup
November 18

Linux: Removing attach storage from a server manually

If multipathing is used find your paths and drive with:
multipath -l (to collect and note the paths to the disk. You will need this information)
Be sure to copy this information to a text editor for future review

Delete paths:
multipath -f path(letter) ( to remove the device from mutipath, where is the mpathX name or alias assigned to the multipath device)

Flush drives:
blockdev –flushbufs /dev/(devicename) ( for each path you collected with multipath -l. This part is especially important when deleting )

Delete drives:
echo 1 > /sys/block/devicename/device/delete

If the above does not work you can do the following:
dmsetup remove -f serialnumberfromthemultipathcommand

Category: Linux | Comments Off on Linux: Removing attach storage from a server manually