dacaprice.com from fitness to technology. mostly technology. sometimes fitness.

3Jan/100

How to run fsck on a Logical Volume in Linux.

I recently had a problem on my laptop running Fedora 11 where my X session just totally froze when trying to bring the laptop back from a hibernate state.  Outside of the occasional issues coming out of hibernate (usually X not restoring) I'd say Fedora 11 has been pretty solid.  This particular time, my X session restored but everything locked up.  I tried switching to another virtual terminal to log in and kill GDM but some sort of inode error just streamed down the console.  My only option was a hard reboot and after that I couldn't boot Fedora with any kernel.  To fix my problem I booted off the Fedora install CD into rescue mode without mounting  / .  I then performed the following:

# lvm pvscan
# lvm vgscan
# lvm lvchange -ay /dev/VolGroup00/LogVol_home
# lvm lvscan
# fsck -yfv /dev/VolGroup00/LogVol_home

Tagged as: , No Comments
21Nov/091

Connect to Cisco routers using screen

screen is a Linux utility that I use to connect to the console on Cisco routers.  If your router is plugged in to a serial port on a Linux box, you can use the following command to connect to it:

[dacaprice@FedoraBox ~]$ screen /dev/ttyS0

Tagged as: 1 Comment
11Nov/090

Changing sdiff column width in Linux

I use sdiff pretty often to do a side-by-side comparison of config files on my Linux box. The thing that annoys me the most is the default column width; often whatever it is I am comparing, gets cut short because the width is too narrow. I like use the -w ColumnWidth to set a wider width and the -s to supress any common lines.

[dacaprice@fedora]$ sdiff -s -w 150 file1 file2

Tagged as: No Comments
4Oct/091

Using script to record a terminal session.

script is a useful utility in Linux that records everything that is printed to stdout to a specified file.

[dacaprice@fedora10 ~]$ script filename.txt

I find script particularly useful for capturing a large amount of output from a router or firewall that I need to save it to a file.

Tagged as: 1 Comment
14Sep/091

The ssh_config file.

Working in an environment with hundreds of SSH servers, one appreciates the value a good ssh_config file.  I use an ssh_config file to specify specific usernames for certain hosts, as well as specifying a keepalive interval, to prevent my session from timing out.

I use the following options:

Host hostname

HostName hostname (can be an IP)

User username

ServerAliveInterval 60 (sends keepalive every 60 seconds)

For further info check out the good old man ssh_config.

Tagged as: 1 Comment