Friday, July 27, 2007

LVM on Linux

I feel stupid for saying this but I played around with LVM on Ubuntu Linux for the first time today. I need to get out more. The benefits to LVM are flexibility. The major downside is critical failure of a physical volume will screw all logical volumes in that pool. Ubuntu Linux has LVM almost completely automated; just choose use the whole disk with LVM and it creates a non-LVM boot partition then a physical volume with the rest. Easy. Adding another physical disk was easy:

root@homer:~# fdisk -l

There will be a message similar to this one, "Disk /dev/sdb doesn't contain a valid partition table", if the disk is brand new. If not, the partition table might require some modifications.

root@homer:~# fdisk /dev/sdb

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

The pvdisplay command can be used to determine the volume group name (VG Name) and display physical volumes. Now to create the physical volume, extend the volume group to include the new physical volue, then create a logical volume within the group.

root@homer:~# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created

root@homer:~# vgextend Ubuntu /dev/sdb1
Volume group "Ubuntu" successfully extended

root@homer:~# lvcreate --name share_01 --size 1016M Ubuntu
Logical volume "share_01" created

Once created, put the ext3 filesystem on the new logical volume

root@homer:~# mkfs.ext3 /dev/Ubuntu/share_01
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
130048 inodes, 260096 blocks
13004 blocks (5.00%) reserved for the super user
First data block=0
8 block groups
32768 blocks per group, 32768 fragments per group
16256 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

Create a mount point then modify the fstab so this new volume mounts.

mkdir /share
root@homer:~# cp /etc/fstab /etc/fstab_20072707
root@homer:~# vi /etc/fstab

Note the backup of fstab made! Reboot the machine and the new logical volume should be available on the mount point

Adding another drive to the pool was just as easy:

root@homer:~# fdisk /dev/sdc

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
root@homer:~# pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created
root@homer:~# vgextend Ubuntu /dev/sdc1
Volume group "Ubuntu" successfully extended

To increase the size of the shared volume:

root@homer:~# umount /share
root@homer:~# lvextend -L2032M /dev/Ubuntu/share_01
Extending logical volume share_01 to 1.98 GB
Logical volume home_01 successfully resized
root@homer:~# e2fsck -f /dev/Ubuntu/share_01
e2fsck 1.38 (30-Jun-2005)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/Ubuntu/share_01: 11/130048 files (0.0% non-contiguous), 8197/260096 blocks
root@homer:~# resize2fs /dev/Ubuntu/share_01
resize2fs 1.38 (30-Jun-2005)
Resizing the filesystem on /dev/Ubuntu/share_01 to 520192 (4k) blocks.
The filesystem on /dev/Ubuntu/share_01 is now 520192 blocks long.

root@homer:~# mount /dev/Ubuntu/share_01 /share_01

Too easy... Here are some links that were very helpful:

Thursday, July 19, 2007

On through the Blog-o-sphere

Occasionally, usually at work when my brain has numbed to the point of being able to be attached to a pole and used to mop floors, I'll use the Next Blog button at the top and just go through the Blog-o-sphere. Here is what I found:
  • 1 epileptic seizure inducing
  • 4 done by 18-21 year old that write like 8 year olds
  • 1 well done, with good content
  • 3 Orientals with nothing better to do than spend money and post pictures of what they ate that day
  • 2 foreign language, living in America complaining about America
  • 1 learning English, living in America, and complaining about America
  • 9 foreign language, outside of America
  • 1 horribly hip, teenage / college student with six zillion picture phone images
  • 1 test / single nothing post
  • 2 myspace wannabe, break stylesheet, l337 individual
  • 1 foreign student in America
  • 1 cool, but with a hundred embedded youtube objects
  • 1 ugly with a hundred embedded youtube objects and link buttons
  • 1 spam
  • 1 American documenting her travels abroad
  • 1 comic book related
  • 1 real estate broker
The good news is the spam blogs are disappearing and almost gone. Also, the myspace wannabe and seizure inducing blogs are down as well. Hopefully they all went to myspace where it's okay to have six jillion youtube objects, pictures, horrifying templates and all sorts of cool but worthless crap. There are a lot of foreign blogs now, which I can't read. The blogs written in English are written at a kindergarden level. Oh well, I can't complain though. I'm certainly not perfect. I do think the blogging craze is starting to die down a little; maybe youtube and similar directions are now the cool thing and blogging is just, ick, words.

Overpriced on eBay

Sometimes I just don't understand buyers on eBay; sellers, too.

I've been watching a specific Dell LCD for a little while now. It retails from Dell at around $320 brand spanking new shipping and tax included. Someone just bought a used one, no warranty, no return instructions from the seller for $321 after shipping on eBay; and they probably would have spent more. The other four almost identical options are shaping up to be similar bidding slap-fests that will end near or over the purchase price for a brand new item with warranty and vendor support.

One seller was selling SATA 150 drives as SATA II drives. When I asked a question about the model number not being the same as a spec from the auction it went unanswered. This seller usually opens up a lot of six to eight of these with very short open times, around a day or less.

I like Shuttle computers, the mini-xPC a.k.a. shoebox computers. A lot of them are being sold as "normally sell for $300 or more"; which is not the case. Not really true for these, though, more like $240 tops and for older technology. You can buy a newer model with current socket / chipset for around $190 plus the memory and processors are actually priced the same or cheaper for more capacity.

Tuesday, July 17, 2007

Blogger to mySQL

The goal of this process was to get the Blog of the Dead (the story blog I work on) into a mySQL database at another location so new readers could start from the beginning then read the blog chronologically starting with the first gripping hours up through where I got bored with the whole thing. Blogger really wasn't designed to relive a story or sequential posts but it suited my purposes at the time.

The mySQL table uses the post date and time as the primary key and includes the author, Blogger permalink, post title and post body. I didn't save comments. Originally I looked at the Google API set but that only seemed to work with recent posts and you had to have feeds enabled.

Note: this only works for Bloggers using the classic templates (like me).

Step 1: Save your existing template

Copy the code for your existing template and save it somewhere locally, you will need to restore it later

Step 2: Replace your template

<Blogger><$BlogItemDateTime$>»<$BlogItemTitle$>»<$BlogItemAuthor$>»<$BlogItemPermalinkUrl$>»<$BlogItemBody$>
«</Blogger>

Step 3: In Settings | Formatting

  1. set Show to 999 days on main page
  2. set Timestamp format to MM/DD/YYYY HH:MM:SS AM|PM
  3. set Convert line breaks to no

Step 4: In Settings | Archiving

  1. set Archive Frequency to No Archive

Step 5: View your blog

Save the source for your blog somewhere locally

Step 6: Reset everything

Reset your formatting and archiving settings then template back to their original settings and content.

You should now have a text file that will need a little massaging to get into mySQL. I used UltraEdit to get the date/time into an ISO standard format and convert Windows CR/LF combinations to simple CR's. The resulting text file can be locally loaded with no column enclosures, no escape characters, \r plus the line terminator character as record ends, and the column separator character as your column separator. I'll revist this later with more details instructions with SED, etc.; I simply wanted to get my notes stored somewhere.

Thursday, July 05, 2007

VMWare Server networking tips

If you are installing a Linux operating system and using two virtual network interfaces: one bridged (i.e. can see the real interface and get to the world) and one host-only, define the host-only interface first then when finished with the virtual machine wizard add the bridged interface. The host only will be assigned eth0, the bridged eth1. On installation each will use DHCP and the nameservers for eth1 will by default override those for eth0.