Mainteance of Linux System part 2
$tar cvpf /mnt/zip/tarball1 /home /etc
tar options:
--diff (short d)
--compare
Tar commands for incremental and differential backups:
$Tar cvpf /mnt/zip/tarball1 --newer 20May02 /home /etc
This command backups all data since 20May02
Linux-backup.net
Tar restore:
$rm linux-syllabus.txt
In tar backups "/" are removed
/home/perry/linux......
$cd /
$tar xvpf /mnt/zip/tarball1 home/perry/linux-syllabus.txt
$tar tvpf /mnt/zip/tarball1 | more - lists all contents of archive
SWAP Space vs. Main Memory (RAM)
Active to Idel and vice verse
How much memory and SWAP should you have?
$free
$free -s 5 - runs free every 5 seconds
SWAP PARTITIONS
$su
$dd if=/dev/zero of=/swapfile bs=1024 count=1024 (add 1 mbyte swap file)
$mkswap /swapfile
$swapon /swapfile
$free
$swapoff /swapfile - turn off swapfile
#df - display available space
#man gdb - GNU Debugger
Gdb -c corefile --- shows what program craeted a core file
CRON
#man cron - daemon to execute scheduled commands (Vixie Cron)
/etc/crontab
#more crontab
#run-parts
#02 4,12,20 * * *
Troubleshooting in Linux Part 2
Troubleshooting
- useful commands
- examine log files
- boot problems
- common problems
$find / -name *.local
Finds all files *.local
$find /etc -name *.local
Start finding in etc directory
-amin n - files was last accessed in n minutes ago
-anewer file - files was last accessed more recently than file was midified.
-anewer is affected by -follow only if -follow comes before -anewer on the command line
-atime n - fiels was accessed n*24 hours ago
-cmin n - files's status was last changed n minutes ago
статус файла - это информация о правах, времени доступа к файлу и прочая служебная информация
#find . -mmin -10 --- finds all files in CURRENT directory that were
modified in 10 minutes
#cd /var/log
#grep network boot.log
#grep network * | more --- finds work network in whole directory
#tail messages -- shows last 10 lines
#tail -f /var/log/message --- WAITS FOR NEW LOGS!!!
(EXAMPLE, login as SU in other terminal, and it'll show in real time with tail -f)
What should you do if you system doesn't bootup
ERROR CODES: google -> lilo error codes
When LILO loads itself, it displays the word LILO. Each letter is printed before or after performing some specific action. If LILO fails at some point, the letters printed so far can be used to identify the problem.
Output Problem
(nothing) No part of LILO has been loaded. LILO either isn't installed or the partition on which its boot sector is located isn't active.
L The first stage boot loader has been loaded and started, but it can't load the second stage boot loader. The two-digit error codes indicate the type of problem. (See also section ``Disk error codes''.) This condition usually indicates a media failure or a geometry mismatch (e.g. bad disk parameters).
LI The first stage boot loader was able to load the second stage boot loader, but has failed to execute it. This can either be caused by a geometry mismatch or by moving /boot/boot.b without running the map installer.
LIL The second stage boot loader has been started, but it can't load the descriptor table from the map file. This is typically caused by a media failure or by a geometry mismatch.
LIL? The second stage boot loader has been loaded at an incorrect address. This is typically caused by a subtle geometry mismatch or by moving /boot/boot.b without running the map installer.
LIL- The descriptor table is corrupt. This can either be caused by a geometry mismatch or by moving /boot/map without running the map installer.
LILO All parts of LILO have been successfully loaded.
If the BIOS signals an error when LILO is trying to load a boot image, the respective error code is displayed. These codes range from 0x00 through 0xbb. See the LILO User Guide for an explanation of these.
How to load without LILO
- Loadlin
Needs: Dos boot floppy, copy of LOADLIN.EXE and a copy of your kernel (VMLINUZ)
Steps:
1)Boot DOS
2)Loadlin vmlinux root=/dev/sda1
Vmlinux - kernel image
Emergency Boot Disk (if disk is corrupted)
Go to www.linux.org/dist
and search for "minimalyst" distributions
Noteworthy:tomsrtbt
Tools for emergency disk:
Drivers, text editor (vi), fdisk, mkfs
$lpr -Php1 (-P print, hp1 printer)
How to print pdf file in command line
$pdf2ps linuxbook.pdf linuxbook.ps
$ls ---- > linuxbook.ps
$lpr linuxbook.ps
Example:
#umount /mnt/cdrom
Umount: /mnt/cdrom: device is busy
#lsof | more ----lists open files in a hole system
#lsof | grep cdrom
#kill -9 PID
#lsof | grep cdrom
#umount /mnt/cdrom
$tar cvpf /mnt/zip/tarball1 /home /etc
tar options:
--diff (short d)
--compare
Tar commands for incremental and differential backups:
$Tar cvpf /mnt/zip/tarball1 --newer 20May02 /home /etc
This command backups all data since 20May02
Linux-backup.net
Tar restore:
$rm linux-syllabus.txt
In tar backups "/" are removed
/home/perry/linux......
$cd /
$tar xvpf /mnt/zip/tarball1 home/perry/linux-syllabus.txt
$tar tvpf /mnt/zip/tarball1 | more - lists all contents of archive
SWAP Space vs. Main Memory (RAM)
Active to Idel and vice verse
How much memory and SWAP should you have?
$free
$free -s 5 - runs free every 5 seconds
SWAP PARTITIONS
$su
$dd if=/dev/zero of=/swapfile bs=1024 count=1024 (add 1 mbyte swap file)
$mkswap /swapfile
$swapon /swapfile
$free
$swapoff /swapfile - turn off swapfile
#df - display available space
#man gdb - GNU Debugger
Gdb -c corefile --- shows what program craeted a core file
CRON
#man cron - daemon to execute scheduled commands (Vixie Cron)
/etc/crontab
#more crontab
#run-parts
#02 4,12,20 * * *
Troubleshooting in Linux Part 2
Troubleshooting
- useful commands
- examine log files
- boot problems
- common problems
$find / -name *.local
Finds all files *.local
$find /etc -name *.local
Start finding in etc directory
-amin n - files was last accessed in n minutes ago
-anewer file - files was last accessed more recently than file was midified.
-anewer is affected by -follow only if -follow comes before -anewer on the command line
-atime n - fiels was accessed n*24 hours ago
-cmin n - files's status was last changed n minutes ago
статус файла - это информация о правах, времени доступа к файлу и прочая служебная информация
#find . -mmin -10 --- finds all files in CURRENT directory that were
modified in 10 minutes
#cd /var/log
#grep network boot.log
#grep network * | more --- finds work network in whole directory
#tail messages -- shows last 10 lines
#tail -f /var/log/message --- WAITS FOR NEW LOGS!!!
(EXAMPLE, login as SU in other terminal, and it'll show in real time with tail -f)
What should you do if you system doesn't bootup
ERROR CODES: google -> lilo error codes
When LILO loads itself, it displays the word LILO. Each letter is printed before or after performing some specific action. If LILO fails at some point, the letters printed so far can be used to identify the problem.
Output Problem
(nothing) No part of LILO has been loaded. LILO either isn't installed or the partition on which its boot sector is located isn't active.
L The first stage boot loader has been loaded and started, but it can't load the second stage boot loader. The two-digit error codes indicate the type of problem. (See also section ``Disk error codes''.) This condition usually indicates a media failure or a geometry mismatch (e.g. bad disk parameters).
LI The first stage boot loader was able to load the second stage boot loader, but has failed to execute it. This can either be caused by a geometry mismatch or by moving /boot/boot.b without running the map installer.
LIL The second stage boot loader has been started, but it can't load the descriptor table from the map file. This is typically caused by a media failure or by a geometry mismatch.
LIL? The second stage boot loader has been loaded at an incorrect address. This is typically caused by a subtle geometry mismatch or by moving /boot/boot.b without running the map installer.
LIL- The descriptor table is corrupt. This can either be caused by a geometry mismatch or by moving /boot/map without running the map installer.
LILO All parts of LILO have been successfully loaded.
If the BIOS signals an error when LILO is trying to load a boot image, the respective error code is displayed. These codes range from 0x00 through 0xbb. See the LILO User Guide for an explanation of these.
How to load without LILO
- Loadlin
Needs: Dos boot floppy, copy of LOADLIN.EXE and a copy of your kernel (VMLINUZ)
Steps:
1)Boot DOS
2)Loadlin vmlinux root=/dev/sda1
Vmlinux - kernel image
Emergency Boot Disk (if disk is corrupted)
Go to www.linux.org/dist
and search for "minimalyst" distributions
Noteworthy:tomsrtbt
Tools for emergency disk:
Drivers, text editor (vi), fdisk, mkfs
$lpr -Php1 (-P print, hp1 printer)
How to print pdf file in command line
$pdf2ps linuxbook.pdf linuxbook.ps
$ls ---- > linuxbook.ps
$lpr linuxbook.ps
Example:
#umount /mnt/cdrom
Umount: /mnt/cdrom: device is busy
#lsof | more ----lists open files in a hole system
#lsof | grep cdrom
#kill -9 PID
#lsof | grep cdrom
#umount /mnt/cdrom
Comments
Post a Comment