I run Gentoo linux on my laptop. I love it because it's based on a constantly updated rolling release which means I get all the latest software when I want it. One of the side benefits of running Gentoo is that I get to do all of the cool linuxy stuff before the other distros get it: Like encrypting my entire root filesystem.
I used to be running Edgy Eft on my laptop before deciding to go back to Gentoo. So I only installed Gentoo on a 20GB partition and left Edgy in a 60GB partitition. I find myself using Gentoo 100% of the time and have all but abandoned Edgy on the laptop (I have nothing against Ubuntu by the way, it's great, and I maintain several other Ubuntu machines).
So, now that I have a few hours spare time today, it was time to get rid of Edgy and resize the Gentoo filesystem to use the entire hard drive. This is usually done with a fine tool like Gparted, but since this is an encrypted filesystem it's not quite that easy.
First things first, backup the partition to another machine:
Run netcat on another machine where you want to store your backup:
nc -l -p 80000 > /path/to/backups/your_image_name.img
Now on the machine you want to backup (substitute sda1 with your partition name):
dd if=/dev/sda1 | nc hostname_of_2nd_machine 80000
This will transfer an image of the partition to the second machine at an incredibly fast speed (I love netcat!)Resize the partition:
Boot up on your Gentoo Live CD.
Run fdisk (or your favorite clone), and jot down the start and end block of the partition you want to keep. In my case it was the first partition and it was on block 1.
Now delete all of the partitions you want to delete as well as the encrypted partition. "WTF?" I hear you say? Yes, that's right, DELETE the encrypted partition. This doesn't actually delete any data mind you, and as long as you correctly remembered the start and end block of the partition you are perfectly safe in doing this.
Now create a NEW partition with the same start block as you originally had. Make the end block anything larger than the original end block. Save your changes.
What we've done at this point is resized the partition which is only part of what we need. We now need to resize the filesystem contained inside the partition.
Now decrypt/map your encrypted partiton however you do it. In my case I do the following:
gpg --decrypt key.gpg 2>/dev/null | cryptsetup luksOpen /dev/sda1 root
Run fsck on it:
fsck -f /dev/mapper/root
And resize it with an appropriate tool (like ext2resize for ext3)
resize2fs will resize the filesystem to the size of the containing partition.
And you're done. Reboot your machine and you'll have more hard drive space available.
I got an email this morning from one of my favorite liberty activists: Michael Badnarik. Michael has been wrapping up a very rigourous campaign for US Congress and so we haven't heard much from him lately. But he is back and sounding better than ever!
Michael began today with his new show Lighting the Fires of Liberty on the We the People Radio Network. I wish Michael the best of luck, I feel that being an educator is one of his best roles and he will do extremely well, I'm sure of it.
Check his out podcast today!
I've been coding in Python for two years now. I've recently been reteaching myself Java because some projects I'm working on require it. So far, about the only fun thing about it has been setting up Emacs abbreviations to handle all of Java's verbose syntax. I am simply amazed at how verbose Java is! Just to illustrate my frustration I coded one of the exercises I was working on in Java as well as in Python:
Yes, both of these code samples do the exact same thing.
On the top is Python. 17 lines of very readable code. On the bottom, weighing in at 28 lines, is Java. Brackets and semicolons are everywhere -- Redundant type declarations and "new" object instantiations -- No syntactic sugar in sight except for the "+" operator that I'm not even allowed to overload myself!
I even think I'm being a bit generous to Java, in the way I've formatted the above code, I've only used a newline when I thought it adds to the readability. You'll note that I closed three whole blocks of code on line 23 instead of on separate lines. Yea, I could start doing this everywhere else to save space but that starts to make the readability of the code much worse than it already is.
Sure, Java is a fine language, it certainly has a long life still ahead of it and will continue to grow and mature... but coming down from a two year long 'Python high' and coming back to Java is.. well.. less than thrilling.
Update: The original java code had newbie-esque syntactical errors that prevented compilation as well as a much larger technical problem: when using an Array as the input for an ArrayList it changes the behaviour of the ArrayList such that it is fixed length meaning it no longer implements a removeAll() method (nor even an add() method, what's a list if you can't add items?!?) Wrapping a Array.asList inside of the ArrayList fixes it, but logically adds yet another line of code and further obfuscates things.