Archive for January, 2010

Canada Cripples Copenhagen

January 31st, 2010

Our spineless excuse for a government has publicly presented the results of the Copenhagen Accord on Climate Change negotiations. Once again, our Conservative government lead by the Right Honourable Stephen Harper has proven that it just doesn’t give a shit.

According to the Globe and Mail, Canada has officially agreed to reduce it’s carbon emissions by 17% from 2005 levels over the next 10 years. Unfortunately, our government still hasn’t managed to meet their 2006 goal of reducing our emissions to 3% lower than 1990 levels.

Dave Martin, a spokesman with the Greenpeace foundation has pointed out that this new target will actually increase our emissions levels by 2.5% over the levels that the Conservative government’s as of yet unaccomplished 2006 goal would have yielded.

We’re heading in exactly the opposite direction that we need to head,” Mr. Martin said. “Not only have they reneged on the target that they adopted a couple of years ago, they have also failed to put in place the regulations that they promised last year – Dave Martin, Greanpeace

While the shockingly nonsensical stance that Greenpeace takes on nuclear technology gives me very little reason to trust anything that the group publishes, Mr. Martin has written some excellent pieces covering the Harper government’s lack of commitment to the Copenhagen process.

But perhaps more worrying than the alleged role that the United State’s own climate policy has played in crafting our targets is the lack of hindsight in the following statement from Conservative Environment Minister Jim Prentice:

Mr. Prentice pointed out the major emitters such as China, Brazil, India and the United States didn’t have obligations to cut emissions under the Kyoto accord. He hopes this time it’s different, and that there will soon be news of emission cuts from countries that haven’t yet announced their own targets. – Bill Graveland, The Globe and Mail

Jim – I hate to have to be the one to break it to you, but your government didn’t cut emissions either. In fact, during the last election, it crippled the Liberal Party’s attempt to put a real plan for cutting our emissions in place. Way to set an example, buddy.

What I Learned at #EpCon

January 19th, 2010

I spent the past weekend at EpCon, a tech conference for college and university students throughout South-Western Ontario that focused on technology, the Internet, entrepreneurship, and networking. Held at the Waterloo Inn, this inaugural year featured keynote speeches from Mike Lee of Rogers Ventures and Steven Woods of Google Waterloo, among others. I saw a lot of cool things, heard a lot of great ideas, and came away with a better understanding of what the tech industry in Ontario has to offer the rest of the world.

Below are a few of the lessons that I picked up during my stay:

Cloud Computing is about…

  • Hype: The core content of 90% of all marketing literature about the cloud is fluff. As a concept, cloud computing is poorly defined; what we have managed to decide on is that the cloud is about only paying for what you use, purchasing services over products, and being able to quickly and intelligently provision new ‘hardware’ via virtualization
  • Low Prices: This is possible because of the ever dropping cost of commodity hardware. Servers are so powerful that they spend most of their time idling. We might as well use those extra cycles to virtualize more machines that can be used by more people
  • Data: Business models based on the cloud have an incentive to make it easy for you to put your data into their service, but hard/unattractive for you to pick up and leave
  • Parallelism: for Great for anything that can be split into chunks and distributed, but not so good for serial  tasks
  • Security Risks: There is a lot of talk, but the reality is a question of whether you want your private records stored on somebody else’s servers. Remember – they have no incentive to keep your privacy, just incentive to make sure that news of a breach doesn’t leak
  • Perception: The Blackberry is one of the most secure devices available, but Obama’s was considered a security risk. Perception is key.

The Internet has Changed the World:

  • The internet is only 20 years old, but consumes a full 5% of the world’s energy. That’s intense.
  • IP technology has had a fundamental impact on how things work, because it’s a global standard. The cost to do business internationally is the same as the cost to do it locally.
  • Between 1995 and 2008, companies that had virtual monopolies on providing information became obsolete. Everybody went online and traditional news media saw massive declines
  • Consumers now control consumption, and piracy can be seen as a push for increased convenience and choice. The irony of the copyright battles is that consumption of media is increasing! The public simply lacks a channel for content that matches their expectations
  • The Internet has come through three distinct phases:
    • Web 1.0 was the push model, wherein content producers pushed content out to consumers
    • Web 2.0 was the share model, when the lines between consumers and producers were blurred, and people chose what they wanted to see, when they wanted to see it
    • Web 3.0 will be the live model, when people have an expectation to have anything that they want at any time, no matter where they are or what device they are using
  • These days, readers, not editors, determine the content. This has been the revolution of the past four years. The democratization of content.
  • The newspaper provides good content, but only one view of the news. It lacks reader interaction, is expensive to produce and distribute, and is at least one day behind current events
  • Online news sites solve the cost, distribution, and latency issues inherent in the traditional model, but still provide a single view of the news and a one-sided conversation about it
  • Blogs and social media changed everything. They are becoming more respected and have been demonstrated to have real impact. At the same time, twitter has been shown to to influence product buzz and box office performances
  • Social media allows people to participate in the discussion, express their opinions, and to provide context to the news
  • Think of just how amazing the Wikipedia project really is. Instead of a small group of experts writing an encyclopaedia, a huge number of people from a diverse array of fields have come together and pooled their combined knowledge into a free resource that rivals the traditional encyclopaedia for accuracy and usefulness.

Creating a Great Product:

  • User-Centric design is essential. You need to know as much as you can about your users, and always strive to provide interaction, insight, and innovation
  • Your development process should be powered by listening: “You have two ears and one mouth. That ratio is not a coincidence”
  • Demo Driven Development: Use daily demos to create a feedback loop that allows you to constantly refine your ideas
  • Customer’s expectations are moving from dynamic to adaptive experiences: Make it modular, open, and multi-platform so that users can have a personalized experience that they can participate in
  • Porn has created at $50M/year industry by moving from the monthly subscription model to a micro-transaction model that is very lucrative. The glut of free apps available for mobile platforms has created a downward price crush that makes it hard to sell an app for a one-time fee. People don’t feel as bad about lots of small transactions, so it’s easier to hook people on something that starts out free.
  • Create value by solving one problem very well. More features can always be implemented later
  • The idea is not your baby! You will get plenty of criticism, and need to be able to adapt. A flawless execution is better than a killer idea. Apple did not invent the mp3 player, but revolutionized it, and changed the industry forever.
  • Questions to ask yourself about a new idea:
    • What is it?
    • Why does it matter?
    • Why doesn’t it already exist?
    • Why can we do it?
    • How can we do it?
    • Can we make money off of it?
    • How do we get out?
  • Having the insight to figure out what’s coming next on the Internet is a huge advantage that can put you well ahead of your competitors
  • So what is the next big thing? It isn’t about apps or hardware or new technologies or even content; it’s about the experience. Everything else is a tool that is used to deliver that experience

On Entrepreneurial Spirit:

  • It has never been easier to implement an idea, and then to quickly find a market for it. The majority of the risk is market related – development is cheap. The Internet solves the traditional problems of marketing and distribution
  • Always strive to be a part of lose/lose partnerships. When you’re having a bad day, your partner should be too. This creates incentive for them to support and work with you.
  • The best base for a start up is a solution to a problem that you’ve encountered in your daily activities. If you’ve encountered that problem, chances are that somebody else has too, and will pay for a solution.
  • Viral marketing can make you lots of money really fast (if you can pull it off without looking fake), but establishing a loyal fan base will make you more money in the long run
  • It is important to get some traction with your product before looking for investment capital. Build a user base first – the money will follow the buzz. Early money is the enemy of an early exit from a successful company.
  • You have to live and breathe your business like a religion
  • You need the best possible people on your team at all times throughout your career
  • The reality of being an entrepreneur involves an immense amount of work and responsibility. You are accountable to your shareholders, customers, partners, employees, and yourself.
  • Experience is key. You don’t know everything, but can learn some of it as you go. Make mistakes on other peoples money, and bring a true professional in when you’re out of your league. They will recoup your investment 100 times over. Seeing the world and learning from others before jumping in with both feet can be an invaluable experience.
  • Remember who you’re doing it for. You can’t work all the time, because you risk losing your family, even if you were doing it for them in the first place. Be sure to create a solid support structure – some days will suck, and you will need people around you to prop you up.
  • Being an entrepreneur is a never ending passion. At the end of the day, it isn’t about the money or the freedom, it’s about the love
  • Quitters never win, winners never quit, but those who never win and never quit are idiots.

Thoughts about Management:

  • Learn to delegate so that the world doesn’t fall apart if you’re not there. You need partners and staff that can step in to fill gaps where necessary
  • Give people accountability and incentive, and let them make their own mistakes. They will work harder for you if they believe in your goal and see personal gain in doing so. At the same time, letting them know exactly how the company is doing gives them feedback to help them cope with hard times, and links performance with hard work
  • Never forget the value of human interaction
  • The promise of the flying car is fact that somebody out there was dreaming. Inspiration comes from those dreams
  • To become a better company, you must know your competition

7 Things that Google does well:

  • Builds teams like startups do – product teams are always made up of less than 10 people
  • Enables internal founders to create
  • 20% of time spent on R&D spans new ideas. Evolving and prototyping are keys to finding the next big thing
  • Encourages teams to attack hard problems and tackle big ideas
  • Compensation is delivery oriented. Bonuses, grants, and awards encourage risks and pay off with good ideas
  • Flat management structure empowers everyone
  • “Innovation is not an option”

Videos and More:

The conference got coverage on our local CTV news, in the KW Record, and some great interviews with the keynote speakers are available over at TechVibes:

Finally, the slide decks from many of the keynotes and presentations are available online at the EpCon website, and you can catch all the latest on EpCon at their website and on twitter.

School’s out for… No Good Reason Whatsoever

January 14th, 2010

Lately, the big political news in Canada has been Prime Minister Stephen Harper’s third prorogation of parliament in as many years. The opposition parties were quick to accuse him of using the move to delay inquiry into the Afghan detainee abuse scandal, while various Canadian pundits have spent the last week putting in their two cents regarding the issue. Those who read into the situation will find many opinions; very few of them are in favour of the Prime Minister, and many of them call his use of prorogation abusive, using his response to last year’s coalition dispute as evidence. For those who need a refresher, The Globe and Mail’s Rex Murphy paints an excellent picture of the effect of that catastrophe on the make-up of Canadian Parliament in this piece.

Personally, I am of the opinion that the leaders of all four major parties are clowns, and that we ought to consider starting over again. Perhaps if we try really hard, we might be able to elect some people who work for more than just sound bites and care about the future of our country beyond the next four years. Since that’s unlikely to happen, I console myself with the writings of comedian Rick Mercer and musician Matthew Good. Together, they pretty much sum up my thoughts on the matter. It is funny though, that while the Liberal Party’s website sports several videos and press releases commenting on the closure of Parliament, the Conservative Party’s site is just the opposite. There isn’t a comment to be found on the matter. Perhaps it’s better that Harper just keep his mouth shut on the issue. He’s already got everything exactly the way that he wants it.

The Wilfrid Laurier Bookstore

January 7th, 2010

As a student at Wilfrid Laurier University, I spend hundreds of dollars per year on my text books. It should be no surprise to anyone familiar with the student lifestyle that as a group, we students tend to be short of money. The cash that we do have is generally obtained from some combination of scholarship programs, OSAP loans, and minimum-wage part-time jobs.

For some years now, I’ve been saving myself about five hundred dollars per year by purchasing my text books used from sellers on Amazon.ca. This year however, my attempts to save myself some rent money were foiled by the WLU Bookstore, a retail entity that sells text books and school supplies on campus.

For as long as I have been a student at Laurier, the bookstore has been responsible for releasing a list of required text books to students through its website and in-store kiosks about four weeks before the start of each new term. In previous years, this has listing included text title, author, and ISBN number, a kind of global tracking number for all books in circulation.

This combination of information has always given me the tools necessary to shop my book purchases around, while still ensuring that I got the correct editions of my text books, many of which change from year to year. This year however, the bookstore has changed its policy, and displays only the text title and price on student’s book lists, which is not enough information to be sure of an expensive online purchase.

Upon seeing that the ISBN number was lacking from the web front-end, I made a call to the bookstore to see if they would provide me with the necessary numbers over the phone. I spoke to the student manager of the bookstore, who told me in no uncertain terms that the new bookstore policy was to not display the ISBN numbers of texts online, because ‘students just take the numbers and buy their books elsewhere.’

Well that couldn’t be right. Wanting more information, I got in touch with a Ms. DaCosta, the head of bookstore operations at Wilfrid Laurier. When asked for the ISBN numbers, she gave me a slew of excuses, including a far fetched tale about their new computer system no longer tracking the number. Seeing as the ISBN number of a book is a unique identifier and also functions as a component of its UPC number, I seriously doubted her story. At the end of an in depth conversation, Ms. DaCosta suggested that I either come down to the bookstore and look up the ISBN numbers myself, or that I purchase the books online, get the numbers from the receipt, and then return the purchased books on the first day of classes.

Now let me take a moment to clarify something. As a consumer, I do not for one moment deny the retail bookstore its right to withhold information about its products from customers. However, since the bookstore is the only official source for the book list, and every student needs access to that list, I would like to see enough useful information on that list for students to be able to purchase their books wherever they see fit. If that means that the Bookstore does not get enough business from the students, they should respond by becoming more competitive in the marketplace, not by withholding necessary information from those students. I already pay thousands of dollars per year in tuition for the privilege of attending university. I should be free to purchase my books wherever it makes economic sense for me to do so.

Not satisfied with the excuses that I got from Ms. DaCosta, I contacted the purchaser for the bookstore, a Mr. Wayne Steffler and asked for some answers regarding the new policy. As his subordinate had, he gave me a slew of excuses for the new policy, and suggested that I wait until the first day of classes, when I would receive course outlines from all of my professors, which he assured me would contain ISBN numbers. On the first day of classes, it was no surprise to me that not one of my course outlines contained the information that I had requested.

In the end, I gave in and purchased all of my books at the WLU bookstore, simply because I ran out of time to fight for answers and needed to start reading for my classes. And so I have started the last term of my five excellent years at Wilfrid Laurier with a bullying from the school that has given me so much.

It turns out that the lowly student manager that I first spoke to on the phone might have been right. The bookstore seems to have changed their policy simply to force students to purchase books from them. As a retail outlet, they are entitled to protect their consumer base as much as possible, but as a university sponsored entity, and as the only official source for the book list, I think that they have gone too far. Nowhere in my agreement with the University is it stated that I must purchase my books through them at market or higher prices, especially when I could purchase them used for half the price and save myself the equivalent of a month’s worth of rent money. Unfortunately, without an ISBN number, I have no way to ensure that the text books that I purchase online will be the ones that I am required to have, and by the time that they show up at my door, it will be too late to do anything about the problem.

Edit: An excerpt of this post was published in the January 13, 2010 issue of the Wilfrid Laurier Cord student newspaper.

Filling a Zune from Linux

January 1st, 2010

Thinking that I was up for a challenge, I decided to spend the day figuring out how to put the music in my Banshee library onto a Microsoft Zune. Since my library contains a good number of FLAC files that I’ve ripped in from my CD collection, my solution called for a caching system that converts the FLAC files to mp3s and stores them so that the playlist can be changed without having to re-convert the FLAC files into something that the Zune can play on every sync. My weapons of choice for the project were a Windows XP instance running inside of Sun Virtual Box, and 126 lines of perl script.

The Steps:

  1. Create a WinXP VM that has the Zune software installed and can see two shared folders on my Linux machine:
    1. My normal Music folder, which contain my entire collection
    2. The cache folders, which contain all of the FLAC files in my collection, but converted to mp3 so that the Zune can play them
  2. Open the Banshee database, located at ~/.config/banshee-1/banshee.db
  3. Select all of the FLAC files in the playlist that we’d like to put on the Zune
  4. For each, check if it has been converted and cached
    1. If so, simply add the path to the cached copy of the track to an m3u file in the cache folder
    2. If not, convert the track, and then add the path to the cached copy of the track to an m3u file in the cache folder
  5. Select all of the mp3 files in the playlist that we’d like to put on the Zune
  6. Put those in a separate m3u file that is located in the Music folder.
  7. Boot up the Zune software on the VM. It should autoscan it’s monitored folders, find the m3u playlists, and put them in its library
  8. Sync the playlists with the Zune by dragging and dropping them to the device icon in the lower left corner of the screen

As previously mentioned, steps 2 through 6 were accomplished by way of a perl script that I can run as often as I like:

#/usr/local/bin/perl

#Requirements: libdbd-sqlite3-perl, flac, lame

#We need database support
use DBI;

#Database path – change this to reflect your user environment
my $dbpath = “dbi:SQLite:dbname=/home/jon/.config/banshee-1/banshee.db”;

#Playlist name – change this to reflect the playlist that you want to export
my $plistname = “Favorites”;

#Cache Path – the path to the directory where you’ve been caching converted FLAC files
my $cachepath = “/home/jon/Storage/mp3Cache/”;

#Music Path – the path to the folder where your music collection is actually stored
my $musicpath = “/home/jon/Music/”;

#Connect to the database – no username/password
my $dbh = DBI->connect($dbpath,”",”",{RaiseError => 1, AutoCommit => 0});

if(!$dbh) {
print “Could not connect to database $dbpath”,”\n”,”Exiting”;
exit;
}

#Pull the list of FLAC files for conversion and caching
my $flac = $dbh->selectall_arrayref(“SELECT sme.TrackID, ct.Title, car.Name AS ‘Artist’, ca.Title AS ‘Album’, ct.Uri, ct.Duration AS ‘Length’ FROM corealbums AS ca, coreartists AS car, coresmartplaylistentries AS sme INNER JOIN coretracks AS ct ON sme.TrackID = ct.TrackID WHERE sme.SmartPlaylistID = (SELECT `SmartPlaylistID` FROM `coresmartplaylists` WHERE `Name` = ‘$plistname’) AND ca.AlbumID = ct.AlbumID AND car.ArtistID = ct.ArtistID AND ct.MimeType LIKE ‘%flac’”);

#open the m3u file to write the cached items to
open my $m3u, ‘>’, $cachepath.$plistname.’_cached.m3u’ or die “Error trying to open cache m3u playlist for overwrite. Do you have write permissions in $cachepath ?”;
print $m3u “#EXTM3U\r\n\r\n”;    #note windows \r\n here

#add /music to $cachepath so that files are in a subdirectory, away from the m3u file
$cachepath = $cachepath.”music/”;
if( ! -e $cachepath ) {
`mkdir “$cachepath”`;
}

#loop through the files and check if they need to be cached
foreach my $i (@$flac) {
my ($trackid, $title, $artist, $album, $uri, $length) = @$i;

#correct the uri by removing the file:// prefix and reverting the uri escaping
$uri = substr $uri, 7;
$uri =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;

#fix time into seconds
$length = int($length/1000);

#check if the flac file has already been converted and cached at cachepath
#if not, convert it and put it at cachepath.
my $path = $cachepath . $artist . ‘/’ . $album . ‘/’ . $title . ‘.mp3′;
if( ! -e $path ) {
#file dne, convert it
print “\nTrack: $title by $artist has not yet been cached, converting…”,”\n”;

#make sure that the file actually exists before attempting to convert it
if( ! -e $uri ) {
print “WARNING: Track $title by $artist does not exist at $uri”,”\n”;
} else {

#ensure that cache album/artist directories exist
my $partpath = $cachepath.$artist;
if( ! -d $partpath ) {
`mkdir “$partpath”`;
}
$partpath = $partpath.’/’.$album;
if( ! -d $partpath ) {
`mkdir “$partpath”`;l
}

#do the conversion – we’re chaining flac and lame here, reading in the flac file from $uri, and putting the resulting mp3 at $path
`flac -cd “$uri” | lame -h – “$path”`;
}
}

#add the track to the m3u file – note that these entries are relative to the location of the m3u file in the root of $cachepath
#the paths use a backslash and a \r\n newline so that they work correctly on windows
print $m3u “#EXTINF:$length,$artist – $title\r\n”;
print $m3u ‘\\music\\’.$artist.’\\’.$album.’\\’.$title.’.mp3′,”\r\n\r\n”;
}

#close the m3u file in the cachepath directory
close $m3u;

#TODO: scan the m3u file and delete any files that aren’t in it from the cache directory

#Pull the list of MP3 files and dump them into an m3u file
my $flac = $dbh->selectall_arrayref(“SELECT sme.TrackID, ct.Title, car.Name AS ‘Artist’, ca.Title AS ‘Album’, ct.Uri, ct.Duration AS ‘Length’ FROM corealbums AS ca, coreartists AS car, coresmartplaylistentries AS sme INNER JOIN coretracks AS ct ON sme.TrackID = ct.TrackID WHERE sme.SmartPlaylistID = (SELECT `SmartPlaylistID` FROM `coresmartplaylists` WHERE `Name` = ‘$plistname’) AND ca.AlbumID = ct.AlbumID AND car.ArtistID = ct.ArtistID AND ct.MimeType LIKE ‘%mp3′”);

#open the m3u file to write the cached items to
open my $m3u, ‘>’, $musicpath.$plistname.’.m3u’ or die “Error trying to open music folder m3u playlist for overwrite. Do you have write permissions in $musicpath ?”;
print $m3u “#EXTM3U\r\n\r\n”;    #note windows \r\n here

#loop through the files and check if they need to be cached
foreach my $i (@$flac) {
my ($trackid, $title, $artist, $album, $uri, $length) = @$i;

#correct the uri to become a windows file path
$uri = substr $uri, 7;            #remove file:// prefix
$uri =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;    #correct uri encoding
$uri =~ s/$musicpath//g;            #remove musicpath prefix
$uri =~ s/\//\\/g;                #change forward slashes to backslashes
$uri = ‘\\’.$uri;                #add the leading backslash

#fix time into seconds
$length = int($length/1000);

#add the track to the m3u file – note that these entries are relative to the location of the m3u file in the root of $cachepath
#the paths use a backslash and a \r\n newline so that they work correctly on windows
print $m3u “#EXTINF:$length,$artist – $title\r\n”;
print $m3u $uri,”\r\n\r\n”;
}

#close the m3u file and the database connection
close $m3u;
$dbh->disconnect;

Sorry for the horrible formatting.

The only snag that I hit during the entire process was really my fault – I have a tendency to overcomplicate things, and did so on this project by initially writing the script to output a *.zpl file instead of a *.m3u file. That didn’t work at all, and I ended up simplifying the script greatly by just outputting an *.m3u file and hoping for the best.

On the off chance that the Zune jukebox software refuses to properly update its playlists after you change the *.m3u files, first try deleting them from the application, and then restarting it. If that doesn’t work, you can write a Windows batch script with code similar to the following:

del /q “C:\Documents and Settings\Jonathan\My Documents\My Music\Zune\Playlists\*”
xcopy “\\Vboxsvr\mp3cache\Favorites_cached.m3u” “C:\Documents and Settings\Jonathan\My Documents\My Music\Zune\Playlists”
xcopy “\\Vboxsvr\music\Favorites.m3u” “C:\Documents and Settings\Jonathan\My Documents\My Music\Zune\Playlists”

This script deletes all files from the Zune playlists directory, and then copies each of the *.m3u files that we created with the above perl script directly into the Zune playlists directory. This should force the application to get it’s act together.

Overall, I’m happy with this patchwork job. It allows me to use the Zune on Linux, which is great because the Zune really is a beautiful piece of hardware. Now if only the libmtp guys could get it working natively, without a WinXP VM…

This piece originally appeared at The Linux Experiment

Setting up an LVM for Storage

January 1st, 2010

Recently, I installed Kubuntu on my PC. Under Windows, I had used RAID1 array to create a storage volume out of two extra 500GB hard drives that I have in my system. Under Linux, I’ve decided to try creating a 1TB LVM out of the drives instead. This should be visible as a single drive, and allow me to store non-essential media files and home partition backups on a separate physical drive, the better to recover from catastrophic failures with. The only problem with this plan: documentation detailing the process of creating an LVM is sparse at best.

The Drive Situation
My machine contains the following drives, which are visible in the /dev directory:

  • sdc: root drive that contains three partitions; 1, 2, and 5, which are my boot, root, and swap partitions respectively
  • sda: 500GB SATA candidate drive that I’d like to add to the LVM
  • sdb: 500GB SATA candidate drive that I’d like to add to the LVM

First Try
Coming from a Windows background, I began by searching out a graphical tool for the job. I found one in my repositories called system-config-lvm 1.1.4.

The graphical tool that I found to create LVMs

I followed the buttons in this tool and created a 1TB LVM spanning sda and sdb, then formatted it with ext3. The result of these steps was an uninitialised LVM that refused to mount at boot. In response, I wrote the following script to activate, mount, and assign permissions to the drive at boot:

#!/bin/bash
sudo whoami
sudo lvchange -a y /dev/Storage/Storage
sudo mount /dev/Storage/Storage /home/jon/Storage
sudo chown jon /home/jon/Storage
sudo chmod 777 /home/jon/Storage

It worked about 50% of the time. Frustrated, I headed over to the #kubuntu IRC channel to find a better solution.

Second Try
On the #kubuntu channel, I got help from a fellow who walked me through the correct creation process from the command line. The steps are as follows:

  1. Create identical partitions on sda and sdb:
    1. sudo fdisk /dev/sda
    2. n to create a new partition on the disk
    3. p to make this the primary partition
    4. 1 to give the partition the number 1 as an identifier. It will then appear as sda1 under /dev
    5. Assign first and last cylinders – I simply used the default values for these options, as I want the partition to span the entire drive
    6. t toggle the type of partition to create
    7. 8e is the hex code for a Linux LVM
    8. w to write your changes to the disk. This will (obviously) overwrite any data on the disk
    9. Repeat steps 1 through 8 for /dev/sdb
    10. Both disks now have partition tables that span their entirety, but neither has been formatted (that step comes later).
  2. Make the partitions available to the LVM:
    1. sudo pvcreate /dev/sda1
    2. sudo pvcreate /dev/sdb1
    3. Notice that the two previous steps addressed the partitions sda1 and sdb1 that we created earlier
  3. Create the Volume Group that will contain our disks:
    1. sudo vgcreate storage /dev/sda1 /dev/sdb1 will create the volume group that spans the two partitions sda1 and sdb1
    2. sudo vgdisplay /dev/storage queries the newly created volume group. In particular, we want the VG Size property. In my case, it is 931.52 GB
  4. Create a Logical Volume from the Volume Group:
    1. sudo lvcreate -L $size(M or G) -n $name $path where $size is the value of the VG Size property from above (G for gigabytes, M for megabytes), $name is the name you’d like to give the new Logical Volume, and $path is the path to the Volume Group that we made in the previous step. My finished command looked like sudo lvcreate -L 931G -n storage dev/storage
    2. sudo lvdisplay /dev/storage queries our new Logical Volume. Taking a look at the LV Size property shows that the ‘storage’ is a 931GB volume.
  5. Put a file system on the Logical Volume ‘storage’:
    1. sudo mkfs.ext4 -L $name -j /dev/storage/storage will put an ext4 file system onto the Logical Volume ‘storage’ with the label $name. I used the label ‘storage’ for mine, just to keep things simple, but you can use whatever you like. Note that this process takes a minute or two, as it has to write all of the inode tables for the new file system. You can use mkfs.ext2 or mkfs.ext3 instead of this command if you want to use a different file system.
  6. Add an fstab entry for ‘storage’ so that it gets mounted on boot:
    1. sudo nano /etc/fstab to open the fstab file in nano with root permissions
    2. Add the line /dev/storage/storage    /home/jon/Storage       ext4    defaults        0       0 at the end of the file, where all of the spaces are tabs. This will cause the system to mount the Logical Volume ‘storage’ to the folder /home/jon/Storage on boot. Check out the wikipedia article on fstab for more information about specific mounting options.
    3. ctrl+x to exit nano
    4. y to write changes to disk
  7. Change the owner of ‘storage’ so that you have read/write access to the LVM
    1. sudo chown -R jon:jon /home/jon/Storage will give ownership to the disk mounted at /home/jon/Storage to the user ‘jon’

Time for a Beer
Whew, that was a lot of work! If all went well, we have managed to create a Logical Volume called storage that spans both sda and sdb, and is formatted with the ext4 file system. This volume will be mounted at boot to the folder Storage in my home directory, allowing me to dump non-essential media files like my music collection and system backups to a large disk that is physically separate from my system partitions.

The final step is to reboot the system, navigate to /home/jon/Storage (or wherever you set the boot point for the LVM in step 6), right-click, and hit properties. At the bottom of the properties dialog, beside ‘Device Usage,’ I can see that the folder in question has 869GB free of a total size of 916GB, which means that the system correctly mounted the LVM on boot. Congratulations to me!

Much thanks to the user ikonia on the #kubuntu IRC channel for all the help.

This piece originally appeared at The Linux Experiment