Wednesday, February 10, 2010

Mounting a LVM volume in Ubuntu (Live CD)

A while back my testing server crashed. This was no surprise to anyone as it was just a (Very) old workstation. However it was running my nagios install in a production setting. I had been meaning to move it to a proper server, but just hadn't gotten around to it. To make matters worse, I didn't back any of it up. So thankfully it was only the motherboard that failed and not the HDD.

I mounted the HDD in another PC I had sitting around and booted it using Ubuntu Live CD.

First, boot Ubuntu.
Second, install the needed tools:
$ sudo apt-get install lvm2
Third, load the modules to do our task:
$ sudo modprobe dm-mod
Fourth, scan the system for LVM volumes. Look for the volumes you want to mount. Typically this will be VolGroup00:
$ sudo vgscan
Fifth, we need to activate the volume(s):
$ sudo vgtchange -ay VolGroup00
Sixth, Look for the logical volume containing the root file system. Typically this will be LogVol00:
$ sudo lvs
Seventh, create the directory to mount the drive:
$ sudo mkdir /mnt/restore
Eighth, Mount the volume to the directory you just created.
$ sudo mount /dev/VolGroup00/LogVol00 /mnt/restore -o ro,user
Ninth, Copy your files off of the drive.
$ cp /mnt/restore/some/dir/and/path /some/dir/and/path
Tenth, Setup what ever backup means you have on the new server!

All in all this wasn't a terrible thing, it could have been much worse. I have since moved the nagios setup to a virtual machine and am backing it up nightly.

Upgrading the Firmware on a 3com 4500 switch

Again, this is mostly for my own notes, but someone else may find it useful. Last year we purchased a 3c0m POE switch for our new VoIP phone system. This year I needed to update the firmware on it, but with only 8MB of flash drive I ran into a few problems.

I used the TFTP method to transfer files to and from the switch. I used Solarwinds TFTP Server on my PC.

File name Prefix / Suffix
s3n / .app = 4500 application software.
s30 / .btm = 4500 boot ROM software
s3p / .web = 4500 web file (HTTP management interface)
3comOScfg.def / .def = 4500 config file

So first things first backing up via TFTP:
<4500>tftp [IP OF TFTP SERVER] put flash:/s3004_01.btm
<4500>tftp [IP OF TFTP SERVER] put flash:/s3p04_03.web
<4500>tftp [IP OF TFTP SERVER] put flash:/
<4500>tftp [IP OF TFTP SERVER] put flash:/3comOScfg.def

Please change these files as you see fit. Do a dir on the root directory to get the listing for your particular switch.

Now that we have that backed up we need to clean up the flash:/ drive to make room for the updates.

<4500>delete s3004_01.btm
<4500>delete s3p04_03.web

Now we also have to empty the recycle-bin. This is where I got stuck as I didn't know a CLI could have a recycle-bin, or have never seen it done before.

<4500>reset recycle-bin

See as we now have the free space we need to get the new files we can pull them down from the TFTP server.
<4500>tftp [IP OF TFTP SERVER] get s3p02_01.web
<4500>tftp [IP OF TFTP SERVER] get s3o01_01.btm
<4500>tftp [IP OF TFTP SERVER] get

Again, you will need to use the files that are the current firmware update.

One of the last steps is to tell the switch what files to use on next boot.
<4500>boot boot-loader flash:/
<4500>boot bootrom flash:/s3o02_01.btm

Finally we will save the configuration and reboot the switch.

Thats it! After the switch reboots you will be running the newest software, except for the .web file. For some reason this is left out of all of the documentation that comes with the update. I didn't write down the commands I used to get it to update, and I honestly don't think they worked.