Linux Tips

From KdjWiki

Jump to: navigation, search

Detailed Tips

Linux Rsync HOWTO
Linux MySQL HOWTO


Administration Tips

Add User:

 # useradd LOGIN -m -G users,wheel,audio,tty -c "FULL NAME" -s /bin/bash
 # passwd LOGIN


Add wheel users to the sudoers list:

 # nano -w /etc/sudoers


Redirect output as root:

As a regular user you can't do (assuming /etc/file requires root access):

 # echo "blah, blah" > /etc/file

Instead:

 # echo "blah, blah" | sudo tee /etc/file

And to append (i.e. replacing echo "blah, blah" >> /etc/file):

 # echo "blah, blah" | sudo tee -a /etc/file


RAID Tips

Test RAID status:

 # cat /proc/mdstat


Create cronjob cheking your /proc/mdstat for 'U' with '_' to identify failure:

 $1 = `cat /proc/mdstat | grep U_`
 $2 = `cat /proc/mdstat | grep _U`
 $3 = `cat /proc/mdstat | grep __`


To rebuild a RAID 1:

  • Power down the system
  • Replace the failed disk
  • Power up the system once again
  • Use: raidhotadd /dev/mdX /dev/hdX to re-insert the disk in the array
  • Watch the automatic reconstruction run


To mount RAID from LiveCD:

Boot from your Rescue device (it must have RAID support of course)

 # startraid /dev/md0

Replace "md0" with the device that contains your root partition.

 # mount -t xfs /dev/md0 /mnt/gentoo

Of course, replace "xfs" with the appropriate filesystem type.