Categories

June 5, 2008

Retrieving LVM volume data with Ubuntu and backup to NFS server

Filed under: Hard and Soft, Linux, Tips and Tricks - baudizm @ 3:08 pm

It’s just a really weird problem that we have today. A perfectly fine Fedora box just suddenly will not boot. When it does not get to initiate booting, GRUB fails saying that the hard drive just cannot be read. The box is somewhat critical and we need to have it running back up (pun intended) since it’s our backup server for most of the managed sites. I guess i’ts not a healthy box as we have been believing.

A little history, it’s an Intel P4-based box on an ASUS P5DR1-VM mobo, on 1GB of RAM. Yeah, it’s not a hefty box. Fedora 8 was installed by a colleague without any issues. Until recently.

It was running fine the other day, then yesterday it just stopped. Checking what happened, the primary hard drive, a Maxtor 80GB PATA, is being bitchy. I rebooted the box and went CMOS. The Maxtor HDD is being identified alright so I proceed to reboot again and see if it will boot up. Again, GRUB stops and cries error reading the drive. “Hmmm.. That’s not right.” I said. I left it overnight and returned to it in the morning.

Another thing that worried me was what if the data on the second hard drive, a Seagate Barracuda 250GB SATA, was also affected? and another thing is that both the Maxtor and the SATA are on LVM!

Aaaarrggghhh!

Crossing fingers, I tried to boot to Fedora 8 install disc and proceeded to use Rescue System. But to no avail… Rescue System wasn’t able to identify a valid Fedora install. “What-the-eff!” Wasting no time, I rebooted and went back to CMOS, all the while feeling the Maxtor hard drive with my hand for any indication that the drive is spinning. Sure enough, CMOS tells me Maxtor’s not there, and the drive isn’t spinning. “Gotcha!” I powered down the box, swapped the hard drive data cable (ribbon cable with new one) and used another Molex power connector (the PSU still has extras) and powered the box up. Checked the CMOS, and voila! Maxtor’s back on the drive list, and the drive is spinning. So far so good. A few things left for me to do — make sure the data is intact, and that I can do backup of the backup (get it?)

This time, I’m using Ubuntu 8.04 Hardy Live CD as my recovery disk. Ubuntu booted smoothly and proceeded to open the Terminal as root. Then tried to check if I’ll be able to see the LVM volumes:

root@linux:~# vgscan
The program 'vgscan' is currently not installed. You can install it by typing:
apt-get install lvm2
bash: vgscan: command not found

Ok, fine. So I proceeded and install lvm2:

root@linux:~# apt-get install lvm2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
dmsetup
The following NEW packages will be installed:
dmsetup lvm2
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 365kB of archives.
After this operation, 1065kB of additional disk space will be used.
Do you want to continue [Y/n]? y

After installing the required package, I proceed to vgscan again, and saw the LVM volume group - in my case VolGroup00. Before I can proceed, I had to do ‘modprobe dm-mod’ first. I leave it up to you as an assignment what this does =) . I then proceeded and typed ‘lvs’ in the terminal. And then proceeded with the magic incantations:

root@linux:~# mkdir /mnt/myLVM
root@linux:~# vgscan
root@linux:~# modprobe dm-mod
root@linux:~# vgchange -ay VolGroup00
root@linux:~# lvs
root@linux:~# mount /dev/VolGroup00/LogVol00 /mnt/myLVM

And there you have it! I got my LVM mounted, and I was able to copy the data I need from it. Whew!

However, my problem is not yet over. I have no clean destination drive to store the would-be-retrieved data. Hmmm, alright. I’m putting it to our shiny Sun Microsystems X2100 M2 server which currently has 500GB of disk space. Fine, fine. It’s running SLES so setting up the NFS server is a no brainer. However, mounting the NFS share into Ubuntu might be challenging. You wish! It’s not that hard. Back to the magic incantations (Ubuntu side):


root@linux:~# apt-get install nfs-common
root@linux:~# mount myNFSserver:/mysharedfolder/subfolder /mnt/myNFSlocal

Bam! NFS share is now mounted locally, and my LVM is reachable as usual. I now start copying my data to the remote machine, and still coyping as of press time. The data is quite huge you know. But I’m happy. But I just don’t want this to happen again.

TechnoratiTechnorati , , , , ,
Site Search Tags: , , , , ,

May 12, 2006

In Cebu: Presenting Zenworks to Lexmark Int’l

Filed under: Hard and Soft - baudizm @ 3:18 pm

I’m in Cebu now, due to Infonet’s request that I be the one to present to Lexmark Intl (Phils) Novell’s Zenworks 7 Suite and Novell’s SuSE Linux Enterprise Server.

Delayed Arrival
I was booked for my Cebu voyage with Trans Asia Shipping Line’s Trans Asia 1. I’ve been boarding its ships ever since. My favorites were the Asia China, and the Asia Thailand. All of them depart and arrive on time. I thought this particular ship, the Trans Asia 1, will be the same. I was wrong. I thought I’d arrive at sometime 6:30 or 7:30. However, I arrived 9:10AM!!! My appointment at Infonet Cebu was at 9:00 so that we will be on time for our appointment with Lexmark at 10AM. Lexmark’s compound is in Mandaue City’s MEZ 2 (Mandaue Eco Zone). With a good deal of traffic, we will be running really late. As soon as I arrived at Infonet’s office, I only got 15 minutes of email check time, and coffee. After that, off we go to Mandaue.

Finally, Lexmark
We arrived at Lexmark’s compound deep inside MEZ2 at about 10:05AM and it’s raining hard. Lexmark’s compound is a sprawling 3,600 sq. meters, with 400 workstations, with only 6 people to manage the insfrastructure. The building’s white all over with green tint on the glass panels. Technicians and Engineers come to and fro oblivious of our presence. I couldn’t imagine how deep their pockets might be, working at Lexmark.

Then walked up the winding stairs to the second floor receiving area, and we were greeted by a guy wearing collared shirt and jeans. At first, I thought he was just asked to accompany us to the boss. Turned out HE IS THE BOSS. The big IT man. Not actually big heightwise. Just normal 5′+ in height, a bit on the chubby side. I thought Ok, here goes.

I introduced myself, and my colleagues followed suit. At first it was kind of a cold reception, a cold non-firm handshake from him. As a result, I shot my first question coldly, and barely audible. I offered him the printed technical white papers on Zenworks and SLES. He began poring over them. Then I asked if I could fire up my laptop to give my presentation. When he gave the go ahead, I’m into my playing field.

A Big Gotcha!

Im not really a marketing guy. I just read more than I should. Im interested with the products that the company I work for is pushing to the market. During the course of the presentation, he interrupted me a couple of times to ask questions. Some were quite detailed, some were just simple. I tried to answer them as best I can. He is the big IT guy, Im a techie selling tech stuff, and no admin. Just an enthusiast. He has wide admin experiences, I meddle with low end hardware and software (until I got this job). However, I got his attention without much fanfair.

At first, he was not really listening much into my presentation. As I get farther and deeper, he put down the printouts, leaned on the sofa, crossed his arms, and listened. He would sometimes interrupt me and move the slides himself on my presentation, which I obliged him to do so. No harm done. He asked details, details, details. I answered with details, details, details. I wasn’t really sure about some, but I tried to sound as convincing. I relied on my experience on the product I’m presenting. And what do you know, he asked for a demo. My colleague popped up the CDs from within the folders she’s having, and informed him of the demo duration. And guess what? He’ll keep in touch when they’re done with the test.

Parting Questions
After I finished my presentation, we said our thanks and goodbyes, and we proceeded to the lobby. It was still raining so we asked the guard to call taxi for use. We waited and then suddenly the cellphone of one of my colleague rang. It was the Lexmark IT Head. He was asking if I’m still with them. She said yes. He asked to hold up. He ran back to the lobby and asked me some more questions. It turned out that after my presentation, he went to search on Zenworks. And most importantly, he was looking at product reviews. GOOD THING! It just shows that he is really interested. I went along with him back to his workspace and looked at the article. E-Week. He got confused because E-Week used Novell Client for Windows in order to manage via Zenworks. I told him, that Novell Client is a general client for Novell products. Supports any client-server product from Novell. He said Ok. Informed him further that Zenwork’s client agents today are all fixed. The article was dated September 2006. It’s 2006. Updates were already made. He gave a further ok. Satisfied, he accompanied me back to the receiving area. I told him to contact us if anything turns out. We’d be happy to help. We can patch up directly to Novell Asia (Malaysia and Singapore) should anything will be unresolved on our end. He affirmed and all is well. We exchanged hand-shakes. However this time, it was warm and accommodating. That showed he was pleased with the presentation (rather I hope he was).

I went back to the lobby, the taxi was waiting, and we’re on our way back to the office.

Trip Back
My trip back will be via Trans Asia 1 still. I don’t care if it will arrive late. My work here in Cebu is done. One owned, and I’m satisfied.

April 24, 2006

HOW-TO: Installing SuSE Linux 10.0

Filed under: Hard and Soft - baudizm @ 3:09 pm

I just finished creating a simple how-to guide on installing SuSE Linux 10.0. You can post your comments here. Check out the page at this page

If the guide/how-to is helpful to you, please feel free to leave your comment here. Thanks!

March 24, 2006

Test Run: XGL, Linux Next Generation Desktop

Filed under: Hard and Soft - baudizm @ 2:26 pm

With Xgl already released and Novell providing significant contributions to Xgl, plus Ubuntu already incorporated it in Dapper, I am relishing at the thought of having more than just a plain Linux desktop.

However, sadly, I wasn’t able to download Dapper’s Flight releases. And SuSE Linux Enterprise Desktop 10 is still no where in sight, I am currently downloading and going to take Kororaa Live CD for a spin.

Kororaa’s lead Chris Smart immediately created this demo sweetie after getting hold of Xgl last February and disappearing for a few days. Out of the public’s sight, he put together this sweetie for download. Visit http://kororaa.org/ for more of Kororaa.

As for Novell’s SuSE Linux Xgl foray, I tried contacting a Novell Tech Support partner in Malaysia hoping that he might have a beta of SLED 10. However, no reply as of yet. I’m also anxious to take this beastie for a spin. So what I did was visit Novell’s OpenSuSE.org site, and proceeded checking out for any how-tos in putting Xgl onto your current SuSE install. And found it i did! You can find it at http://en.opensuse.org/Using_Xgl_on_SUSE_Linux

As for Dapper, sadly I wasn’t able to download any of it’s flights. When I visited shipit.ubuntu.com to request for Dapper when it ships, the site is updating or upgrading or something like it so, no dice. My only chance to take a glimpse at Xgl firsthand will be through Kororaa, which by the way is Gentoo-based.

Can’t wait… can’t wait… will put a little review on Xgl when I manage to take it for a spin. CIAO!

March 14, 2006

The “OnlyShowin” property of .desktop files [UPDATE]

Filed under: Hard and Soft - baudizm @ 5:23 pm

Note: This is an update to my previous post. However, this post is courtesy of a good friend and mentor — Sir Botp — who studied the script I presented in the previous post. Every word in the succeeding article is HIS.

An Analysis of the “OnlyShowin” Script
by Sir Botp

on the first test run, i get,

botp@jedi-hopeful:~$ ./test
grep: OnlyShowin=foo1.bar: No such file or directory
grep: OnlyShowin=foo2.bar: No such file or directory
grep: OnlyShowin=foo3.bar: No such file or directory

the grep is treating the search text as part of the file name and is only searching for the beginning of line marker “^”. The test fails of course and therefore the text “OnlyShowin=GNOME” is always appended… which appears to work :)

on the successive test runs, the text is being appended _always,

botp@jedi-hopeful:~$ cat foo1.bar
test
OnlyShowin=GNOME
OnlyShowin=GNOME;
OnlyShowin=GNOME;
test
OnlyShowin=GNOME;
OnlyShowin=GNOME;

..ergo the original file is being bloated..

so we have the ff initial modifications again,

botp@jedi-hopeful:~$ cat test
!/bin/bash
for i in *.desktop; do
if ! grep -q ^OnlyShowin= $i; then # modified line
echo "OnlyShowin=GNOME;" >> $i;
fi
done

the modified line means, if you do not see the text “OnlyShowin=” at the beginning of the line, then append the text “OnlyShowin=GNOME” (the -q is silent mode)

this works without the errors but it will not append the text we want if
1 there is a space before OnlyShowin..
2 the line contains OnlyShowin=XFCE or anything
3 the line contains OnlyShowin=KDE. Therefore, if the line contains OnlyShowin=KDE, you cannot replace it with GNOME…

another modification again, we do not want to replace if GNOME is there

botp@jedi-hopeful:~$ cat test
!/bin/bash
for j in *.desktop; do
if ! grep -q ^OnlyShowin=GNOME $j; then # modified line
echo "OnlyShowin=GNOME;" >> $j;
fi
done

(note i replaced the “i” var with “j” kay na-igo ko sa “i or 1″ syndrome :)
Trans: (note i replaced the “i” var with “j” because of the “i” and “1″ syndrome :)

This works but it has problems with files containing lines like these,

botp@jedi-hopeful:~$ cat foo2.bar
OnlyShowin=GNOME
OnlyShowin=test;
OnlyShowin=KDE;

in the meantime, it may be better to do brute force na lang which will always work. We just remove the conditional…

botp@jedi-hopeful:~$ cat test
!/bin/bash
for j in *.desktop; do
echo "OnlyShowin=GNOME;" >> $j;
done

This works because the last setting always overrides.. but as expected, you get a bloated and dirty ends of files with

botp@jedi-hopeful:~$ cat foo2.bar
OnlyShowin=GNOME
OnlyShowin=test;
OnlyShowin=KDE;
OnlyShowin=KDE;

We can use awk to resolve and fine tune but i much prefer ruby… That will be for next time..

March 13, 2006

Restoring Grub using Knoppix 4

Filed under: Hard and Soft - baudizm @ 2:35 pm

This might be very common for everybody else, however, I still posted this just in case somebody else is reading and is looking for a fix, a solution, or just something to read.

Just a note though. The method I’m stating below might not work with your setup. I’m using Ubuntu 5.10 Breezy with customized partitioning.

The original thing I needed was to have a dual boot system using Windows 2000 and Ubuntu. Although I really do not need to dual boot, an urgent need arose since I needed to have a working Windows machine to test the agent deployment of Zenworks 7 Patch Management Server.

To start off, I determined how I am going to go about my installations. It is much better for you to plan whatever you want to accomplish with your Linux box even before you do any install. So I decided to divide my 80 GB HDD into 2 partitions (actually 3 if swap is included). 20 GB will go for the Windows partition, 1 GB for the swap, and the rest is for Breezy.

Proceeding with the partitioning itself, I booted the Breezy Install CD, and typed “expert” (without quotes) on the boot prompt then pressed . When I got to the partitioning part, I chose “primary” then chose the mount point as “/windows”. I then chose the partition type as “FAT”. I then proceeded to create the rest of the partitions, choosing “primary” and then Resierfs, with mount point specified as “/”. And then also created the swap partition.

I did not continue the install process. Since it is in expert mode, I was presented with a set of menus where I can choose which portion of the install to perform. Since I already created the partitions, I scrolled down and chose to finish the installation. Then restarted. I then inserted the Windows 2000 install disc on the CD drive and allowed the disc to boot. Luckily, the disc booted without a hitch. Then when I got to the section where you need to choose which partition to install Windows to, I chose the FAT partition (the first partition I created on the Breezy install cd), disregarding my Linux partitions. I then allowed the installer to format the partition, then proceeded with the Windows installation as normal.

When the system restarted for the first time after completion, Windows started normally without a hitch. I then restarted and proceeded installing Breezy on the other partition as normal. Breezy install was able to detect the existing installed Windows and proceeded with the installation. After completion, I was presented with a white-text-on-black Grub menu allowing me to select which OS to boot. I guess everything went ok. I proceeded to boot with Breezy first, then booted with Win2K.

The problem started when I tried to install Rise of Nations on Win2K. The installer might have been corrupted that when it completed installing the game including DirectX 9 and restarted the system, I found Win2K no longer continues to boot. Instead the OS was messed up. Instead of finding out what went wrong, I decided to install WinXP instead.

Installing WinXP from CD went without a hitch. However, when I restarted after the install, I found out I can no longer see the Grub menu nor am I able to boot to Breezy. Although not at all shocked, I just hated XP for doing so.

Well, to rectify the situation, I pulled out Knoppix 4 (thanks Matt for this copy! it saved me lots of time) and booted on the minimal by typing “knoppix 2″ (no quotes) on the boot menu.

When Knoppix finished loading, I was greeted with the sweetest root prompt I’ve seen during the day. I then proceeded in mounting my second partition to the /mnt/hda2 directory. Knoppix by the way creates folders on the /mnt that matches your existing partitions however will not mount them. That makes it easy for you to mount your existing partition coz Knoppix uses the same name as your partition number.

Here’s what I typed:

root@knoppix:~# mount /dev/hda2 /mnt/hda2
root@knoppix:~# chroot /mnt/hda2

After mounting the Breezy partition, /dev/hda2, I chrooted to it via the command “chroot /mnt/hda2″ in order to perform the reinstallation of Grub into that partition.

I then proceeded in restoring Grub using the ff:

sh2xx:~# grub
sh2xx:~# root (hd0,1)
sh2xx:~# setup (hd0)

“root (hdo,1)” is our way of telling grub that our root partition is located in the second partition of our first hard drive. Grub by the way is 0-based so it starts counting from 0. So to tell grub we mean the first hard drive (hda), we tell it “hd0″. When we passed (hd0,1) we meant the second partition of the first hard drive.

Examples:
(hd0,0) - first partition of first drive
(hd0,1) - second partition of first drive
(hd1,0) - first partition of second drive
(hd1,1) - second partition of second drive

The command “setup (hd0)” was meant to tell Grub to reside in our hard drive. That’s it.
Then I exited from Grub’s interface by typing “quit” then “exit” in the bash prompt.

I then rebooted the system and found the old Grub menu back. However, when I chose the entry “Windows 2000″, Windows XP booted :-) . No problem, it’s just the Grub menu entry not being updated. I can modify it by going to /boot/grub then editing the menu.lst file. But I didnt have the need to do so. So I left the menu entry alone, at least my box now boots both Breezy and XP without a hitch.

Note though that I use XP only as a test subject and nothing more :) . CIAO!

March 8, 2006

The “OnlyShowin” property of .desktop files

Filed under: Hard and Soft - baudizm @ 6:05 pm

Have you ever found yourself scratching your head after you installed a second GUI in your Ubuntu box just because Gnome-only items were appearing on KDE, and KDE-only items appearing on Gnome? I’ve had that experience myself. I said to my self I better find a way to keep Gnome-only items within Gnome, and KDE-only items in KDE.

Googling paid off and found a little “hack” within the official Ubuntu forums. Sorry forgot the links. The original script was done on the command line. But I had problems executing the little script so I put it in a single file.

To do it, edit a file:

root@vine:/usr/share/applications# vi restr_toGnome

The code is:

#!/bin/bash
for i in *.desktop; do
if ! grep -q ^ OnlyShowin=$i; then
echo "OnlyShowin=GNOME;" >> $i;
fi
done

Save the file. Then allow the file to be executed:

root@vine:/usr/share/applications# chmod 0755 restr_toGnome

Execute the file like so:

root@vine:/usr/share/applications# sh restr_toGnome

The script might give you an error which says “No file or directory.” Just ignore this. Check your file (ex. less yelp.desktop) and check the end of the file if the line “OnlyShowin=GNOME;” without quotes is there.

To use the script for KDE, make sure you have KDE or kubuntu-desktop installed (apt-get install kubuntu-desktop). Then copy the script to /usr/share/applications/kde. Rename the file to restr_toKDE, then edit the file via vi. Change the “OnlyShowin=GNOME;” to “OnlyShowin=KDE;” then you’re set to go.

Execute the script like the first one and check if at the end of the .desktop file there’s a line that says “OnlyShowin=KDE;”.

Reboot and you’re all set.

February 14, 2006

RAID 5 PATA Setting on IBM eServers

Filed under: Hard and Soft - baudizm @ 9:04 am

We felt the need to take a look at doing RAID 5 on an IBM machine and making it dual bootable with Windows 2000 Server and Novell’s SLES 9. And here’s what we found out.

Machine: IBM 226 eServer
CPU: 3.0 Intel Pentium 4 with HT
Memory: 1 Gb
Dual Booted OS: Novell SLES 9 and Windows 2000 Server Standard Ed.
Disks: 3x 73Gb SCSI Hotswap
RAID: RAID 5 (striping) using IBM Server RAID 6i add-on card. The builtin BIOS RAID only supports only RAID 1.

Initial observation:
Out of the box, the IBM Server functioned well using RAID 5 after initially installing Windows 2000 Server. The OS was installed by going through IBM’s bundled Server Guide in order to properly setup RAID 5.

We followed the setup with SuSE Linux Enterprise Server 9, allowing SLES to do the partition resizing through its partitioning tool. The partition we allotted for the Linux partition was about 50% of the resulting logical drive after implementing RAID 5. The chosen bootloader was Grub. First few reboots went ok for the day. The second day proved to be challenging.

On the second day, first cold boot went ok. On the second reboot, Grub refused to budge after selecting Linux in the graphical menu. Another restart and we chose to boot Windows, however, it too refused to continue. Only the Grub menu entry for the Windows partition was visible.

We opted to redo the whole setup. And still ended having the same results as the initial install.

We looked over to the BIOS and searched around, until my coworker Ray found something. He noticed the Parallel ATA setting was disabled. Selected it and enabled it. Then performed a restart. We chose to redo the whole setup on last time WITH THE PATA setting turned on.

Everything went on without problems. Installed Windows 2000 Server through the Server Guide, followed installing SLES 9 after that. Then tried a couple of restarts. No more Grub errors and no hung-ups. Proceeded installing a couple of packages & services for Linux. Added some more packages to the Windows 2000 install. Did some more restarts. The system proved to be stable.

Conclusion: Enable Parallel ATA (PATA)


Get free blog up and running in minutes with Blogsome | Theme designs available here


74% Geek