Wednesday, October 21, 2009

8:03 PM Posted by: Rupinder Saini 0 comments


Software Raid

1. Create device:

root@host:/# mknod /dev/md0 b 9 0  root@host:/# mknod /dev/md1 b 9 1  [...] 
2. Create partitions:
root@host:/# fdisk /dev/sda  root@host:/# fdisk /dev/sdb  
3. Create filesystem:
root@host:/# mkreiserfs /dev/sda1  root@host:/# mkreiserfs /dev/sdb1  [...] 
4. Cretate RAID:
root@host:/# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1 root@host:/# mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2 [...] 

Crontab

How to edit crontab with favourite editor..

root@host:/# export VISUAL="nano -w"  

Samba

Connect to a samba share on another computer...

root@host:/# smbmount //192.168.78.5/share /local/share -o rw,username=piggy,password=XXXXXXXX 

Connect to a domain...

root@host:/# net rpc join MEMBER -S server -U user%password 

Linux Kernel

Patching

root@host:/# cd /usr/src/linux root@host:/# patch -p1 

Basic commands

Q: How do I remove or access a file that has a filename that begins with special characters?
A: Use ./ before the filename

root@host:/# rm ./--bad-filename 

Q: How do I use find to locate files and run a command on the found files?
A: Use the the -exec '{}' \; parameters:

find ./ -name "*.$$$" -exec chmod +w '{}' \; 

LILO

Q: I get this LILO warning when booting up: "Error: Duplicated Volume Id"
A: Run lilo and clear the volume serial number on the boot device

root@host:/# lilo -z -M /dev/hda 

Swapfile - not swap partition - in Linux 2.6.x

Q: How do you create and use a swapfile in Linux 2.6?
A: Well look below, make the swapfile as big as the internal memory.

root@host:/# dd if=/dev/zero of=/swapfile bs=1M count=256 root@host:/# mkswap /swapfile  Edit /etc/fstab, add: /swapfile  none   swap   defaults  0 0  root@host:/# swapon -a  Be sure to mount the swapfile after regular file systems is mounted (in your startup scripts): /bin/mount -n -o remount,rw /bin/rm -f /etc/mtab* /bin/mount -a -O no_netdev swapon -a 

No pxe boot after doing a warm boot

Q: Why doesn't my computer (Soekris, EPIA box) boot via PXE after a warm reboot?
A: Apparently a problem with Linux/Wake On Lan. Get ethtool and run this command in a startup or shutdown script:

ethtool -s eth0 wol d 

Count unique rows in httpd access file

grep sakerhetsbesiktning/index2.html assa.access |sed 's/\([0-9.]*\).*/\1/g'|sort|uniq|wc -l 

Convert several images in a folder

for img in `ls *.JPG` ; do for> convert $img -resize 640x480 thumb-$img for> done 

Find large folders

du -h | egrep -e [0-9\.]+G 

SSH without login

No comments:

Post a Comment

More Tricks

 


2009 Latest Linux Mania. All rights reserved.
Powered by Beta Templates and Blogger.
Template and Icons by IT-ICSITE.COM