LVM Breaks When Upgrading Debian Etch to Lenny 4.x to 5.0

Using the standard upgrade proceedures, Debian Etch + LVM will fail to upgrade to Debian Lenny gracefully.  This is due to the kernel modules and is simple to avoid.

  1. Before changing apt sources (They should be etch)
  2. apt-get update
  3. apt-get upgrade
  4. reboot if kernel upgrades
  5. Now change your apt sources  (Lenny or Stable)
  6. apt-get update
  7. apt-get upgrade
  8. NOTE: At this point lvm2 is probably held back.
  9. Reboot if the kernel upgrades
  10. NOW do your dist upgrade
  11. apt-get update
  12. apt-get dist-upgrade
  13. NOTE: At this point lvm2 is probably still held back.
  14. Reboot
  15. apt-get update
  16. apt-get install lvm2
  17. Reboot

TADA!  You have to reboot a couple times, but you never have to touch the configs or the mapper.

Did you find this post useful or have questions or comments? Please let me know!

Posted in Debian, How Tos, LVM | 4 Comments

PERL How To Print A List Without A Loop

PERL has a built-in function called join() that will concatenate a list with a given string. The official perldoc states:

join EXPR,LIST
Joins the separate strings of LIST into a single string with fields separated by the value of EXPR, and returns that new string. Example:

$rec = join(':', $login,$passwd,$uid,$gid,$gcos,$home,$shell);

From the code example, you can make CSV output and all kinds of goodies, but what the doc misses and the example doesn’t show is that combining join() with a print statement makes writing lists to STDOUT or a file handle a snap. This is where join() really shines.

Example:

Code
@names = ('Mark', 'Jim', 'Bob','Mary','Steven','Gomer');
print join("\n", @names);

Output
Mark
Jim
Bob
Mary
Steven
Gomer

Note that this will NOT print a final or beginning string. Join() concatenates the elements, meaning it puts the string value BETWEEN the list elements.

Did you find this post useful or have questions or comments? Please let me know!

Posted in How Tos, perl, Programming, Software | Leave a comment

SQL: Select duplicate rows, select indistinct rows

Using SQL, MySQL or whatever your favorite database may be, we all know using SELECT DISTINCT will return unique values in case a value appears more than once in a table.

How do you fine duplicates? What if I want to know where the duplicates are?

The trick is to use count() and compare it to an integer.

SELECT count(*), locations.* FROM locations GROUP BY number HAVING COUNT(*) > 1

That will select a count of unique instances of a value from a table called “locations”, group them by a field called “number” where the count is greater than 1. In other words, it will return all the fields where there are more than one instance of the same value in the column “number”.

Did you find this post useful or have questions or comments? Please let me know!

Posted in How Tos, mysql, SQL | Tagged , , | 1 Comment