Mounting a ‘Foreign’ LVM Volume

First, what do I mean by foreign?  Foreign means mounting the logical volume with an OS that it wasn’t originally installed on.  This could be because you are using KNOPPIX to repair something on the volume, or because you’ve moved the disk to a new location.

The process itself if quite simple, but it would help if you understood how logical volumes work first.  Click here for some nice background

Mounting an LVM Volume

  1. First Identify it with the fdisk command
  2. And find the VolGroup with the pvs command
  3. lvdisplay will show you the Logical Volume
  4. Finally mount it

# fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes255 heads, 63 sectors/track, 60801 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes
Device Boot      Start         End      Blocks   Id  System/dev/sda1   *           1          13      104391   83 Linux/dev/sda2              14       60801   488279610   8e  Linux LVM

# pvs  PV         VG         Fmt  Attr PSize   PFree
/dev/sda2  VolGroup00 lvm2 a-   465.66G    0

lvdisplay

Okay, this isn’t finished yet, but I published it so that next time I’m working on this task I’ll complete it.  If you have any suggestions or want to complete this list. let me know.

About Jay Farschman - Jay currently works as a Senior Systems Administrator for an asset management company in Colorado where he works with companies that produce hardware, telecommunications software and financial services.  Jay previously owned a consulting company and provided training and consulting services for three Fortune 500 companies and numerous small businesses where he leveraged Linux to provided exceptional value.

Nmap with three commands

Network Mapper is an essential tool for every SysAdmin.  You need to probe around the network to make sure people haven’t left ports open in a haphazard manner.   These commands should get you ther.

Ping sweep and a reverse DNS shows you who is on the logical network with you:

nmap -sP 10.1.1.0/24

-sS does a bit of scanning for ports

nmap -sS 10.1.1.23

Or you can set off all the alarms on the network with the following pots scan of everything.

nmap -O 10.1.1.0/24

About Jay Farschman - Jay currently works as a Senior Systems Administrator for an asset management company in Colorado where he works with companies that produce hardware, telecommunications software and financial services.  Jay previously owned a consulting company and provided training and consulting services for three Fortune 500 companies and numerous small businesses where he leveraged Linux to provided exceptional value.

 

Using fPing to look at a Range

The fping utility is a f-ing useful with a simple command line.  One word of caution.  If you work with other network administrators they sometimes don’t take kindly to having their network ping scanned.  In fact, there are a number of products out that that will detect, log and and some case take actions against the originating IP Address.  Play nice.

$ fping -c1 -gds 10.1.1.0/24 2>&1| egrep -v "ICMP|xmt" 

10.1.1.1        : [0], 96 bytes, 0.23 ms (0.23 avg, 0% loss)

Play around with it, but it going to scan the range and display something like the above entry.

About Jay Farschman - Jay currently works as a Senior Systems Administrator for an asset management company in Colorado where he works with companies that produce hardware, telecommunications software and financial services.  Jay previously owned a consulting company and provided training and consulting services for three Fortune 500 companies and numerous small businesses where he leveraged Linux to provided exceptional value.

Changing the Hostname in Redhat/CentOS

Rebooting is not required on CentOS and RHEL5, but on version 6 the sys logger isn’t running as a service.  I recently exposed my own ignorance on RHEL6 by simply rebooting.  If you happen to have the time to learn what we need to stop and start in version 6 please drop me a note.

Otherwise these are the simple instructions.

  1. Change the ^HOSTNAME line in /etc/sysconfig/network
  2. Change the hostname (FQDN and alias) in /etc/hosts
  3. Run hostname new_hostname for the hostname change to take effect immediately.
  4. Run service syslog restart for syslog to log using the new hostname.

You may also find that the banner needs to be rebuilt /etc/motd

About Jay Farschman - Jay currently works as a Senior Systems Administrator for an asset management company in Colorado where he works with companies that produce hardware, telecommunications software and financial services.  Jay previously owned a consulting company and provided training and consulting services for three Fortune 500 companies and numerous small businesses where he leveraged Linux to provided exceptional value.

Basic Knowledge – Adding a Second Drive to Linux

A Unix Newbie Article – Adding in a second drive (or 3rd, 4th, etc.) is a fairly easy process, but it’s easy to make mistakes. This articles shows you line-by-line methodology that should work for you.

# Find out what’s been detected and what’s in use
# do _NOT_ mess things up … you can format your active
# partition with this tool and have to rebuild.
fdisk -l
# Run fdisk
# Basically do an ‘n’ ‘p’ ‘1′ ‘w’ to create a new, primary partition
fdisk /dev/sdd1
# Format it and and build the mount points.
mkfs.ext3 -m 0 -j /dev/sdd1
mkdir -p /space1
# Edit the /etc/fstab
/dev/sdd1 /space1 ext3 defaults 1 2
# Mount them
mount -a

One note here… when you do a df command df -h the drives will appear in the order that they appear in the fstab file. You can therefore make things look pretty if you need to.

 

Measuring Drive Speed in Linux

Benchmarking drive speed is made a lot easier in Linux by the presence of a tool, hdparm.  On IDE style drives and ATA running with the arbitrator they produce pretty good results:

#hdparm -t /partition/totest

Some Original Results prior to messing with the strip sizes:

PowerEdge 2950 -> 20 to 90 mb/sec
PowerEdge 6800 -> 25 to 30 mb/sec

hdparm _only_ works when the Integrated Drive Electronics (IDE) are talking directly to the system over the AT Attachment (ATA) arbitrator.  So see if you are running the libata module by using the lsmod command. If you see it is running… but remember it could be running for one set of diskc and not another.

YOUR BEST BET: Use “modinfo -p” on the vendor’s SCSI driver to see what options are supported at load time.

Other note to measure Random access times… use seeker.c and compile it. it will run a series of random seeks and report the times.  After some rebuilds I have done some benchmarking along with some changes to increase RAID5 stripe sizes in the PE2950 systems:

# New Results After Increasing the Strip Size
Backup Server PowerEdge 2950 – 319.06 MB/sec
PowerEdge 6800 - 92.16 MB/sec

This is by no means a comprehensive discussion of benchmarking, but it’s a good way to start the conversation and it only takes a few moments

About Jay Farschman - Jay currently works as a Senior Systems Administrator for an asset management company in Colorado where he works with companies that produce hardware, telecommunications software and financial services.  Jay previously owned a consulting company and provided training and consulting services for three Fortune 500 companies and numerous small businesses where he leveraged Linux to provided exceptional value.