Painlessly moving /var to a new partition

When I installed my current Linux system, I created a root partition of only 10GB (mainly because I already had another distribution installed that I wanted to keep as a backup). While this is enough for my purposes, Audacity regularly filled up the whole partition with data in /var/tmp/audacity-daria. That is not only annoying (because Audacity will stop working), but also potentially dangerous for the stability of the whole system.
Now I could have just knocked off the other distribution and resized the root partition, but it occured to me that it would be a better way to just use its existing partition and move /var to it.

I found various different tutorials on how to do this around the web, so to make confusion complete I decided to add my own. 😀
I am currently running Ubuntu 13.10 (64-Bit), but this should work on any other recent Ubuntu/Debian release, and probably on most other current distributions, too.
I should also mention that I assume you have some basic knowledge about the file system structure on a linux system, that you know what a terminal is and you’re not afraid to use it. 😉

First of all, we need to format the partition we are going to move /var to. I did this with the graphical tool gparted. Some people use reiserfs, I simply stuck with ext4. In my case, the partition’s name is /dev/sda4. At this point, also create a new directory /var2 by entering sudo mkdir /var2. This is going to be our temporary mount point.
Before you edit your /etc/fstab file, make a backup of it! I am serious; if you do ANYTHING wrong, your whole system will be unable to boot!!! To do this, move to the directory and copy it:
cd /etc
sudo cp fstab fstab_backup

Now we can put our new partition into the fstab. Find out its UUID with the command blkid, that will return something like this:
/dev/sda1: UUID="e9325f37-4394-409f-bd9a-cb473ad0379f" TYPE="ext4"
/dev/sda2: UUID="75c07cfd-99ab-4a9f-a25c-d6db771c3565" TYPE="swap"
/dev/sda3: UUID="306b4fea-31c5-4eae-b631-c89374c28c12" TYPE="ext4"
/dev/sda4: UUID="20b0eecf-e80e-4d37-abe6-d2a2bb20078d" TYPE="ext4"
/dev/zram0: UUID="78caa6fc-d44e-4826-8e60-d0fc07e660cc" TYPE="swap"
/dev/zram1: UUID="323ad229-b8c4-44c5-8e56-006ca1fcaa9a" TYPE="swap"

Copy the value for /dev/sda4 (or whatever your partition is) without the quotation marks, and open the fstab with a text editor of your choice. I simply use nano: sudo nano /etc/fstab

Add the line for your new partition, so that it looks something like this:
UUID=20b0eecf-e80e-4d37-abe6-d2a2bb20078d /var2           ext4    defaults        0       2
(If you are curious what the other options mean, you might want to check the manpage for fstab.)

To mount everything according to new fstab, enter sudo mount -a. If no error occurs, you can also check if it has been correctly mounted with mount or gparted.

Now comes the tricky part. Enter sudo init 1, your system will drop down into single user mode, leaving you with only a root prompt. Now we need to copy everything from the „old“ /var to the new one. Enter sudo cp -a /var/* /var2/ – this may take a while. If you’re curious about the progress, add the option -v. You can check the correct execution by typing ls /var and ls /var2, which should look mostly the same.

If you want to empty the old /var, you need to do this now – you won’t be able to do it from within the system later on! But unless you urgently need space on the root partition, I wouldn’t touch anything more that necessary, just to be safe and able to go back, just in case.

Now, go back to the fstab, and just change the line for /var2 into /var. Again, you might want to check whether that worked by entering mount -a and mount.

Congratulations, we’re done! Type reboot and your system should come up like it has always been that way.

If you found any mistakes in my little tutorial, please drop me an e-mail!

SAQ Christmas transmission 2012

Oh, was I looking forward to last year’s final SAQ transmission. While some of my „normal“ friends might argue that it’s always the same, it is still exciting to listen to VLF every time. Not only are there notable differences in propagation and atmospheric noise, especially when comparing summer and winter, it is also interesting to build new equipment or try out different locations. And since, at least when it comes to SAQ, there are not that many occasions for testing during the year, it is something to look forward to every time.

So, this was my setup: 20m loudspeaker cable (also used as an universal short-wave antenna, being fed through an 1:9 UnUn), homebrew VLF converter (following the „MRK-20“ schematic), Icom IC-728 transceiver for reception – all setup at my QTH in Barsinghausen.
While the equipment itself proved to work quite well, all I received below 30 kHz was strong humming and hissing, reaching peaks between S7 and S9. I did get up early on Christmas morning, hoping that I would receive something, anyway, but had no luck.
I have to add that the man-made noise level seems to have vastly increased since the year before, when I used virtually the same setup. The 80m band was also heavily affected – while it worked quite okay the year before, it now was hard to use even in digital modes, not to speak of phone (which also explains why I only got 32 QSOs (55 in 2011) in the DARC Christmas Contest, even though I was now allowed to use both 80m and 40m instead of only 80m – but that’s a different story).
Since I’m pretty sure that it is none of our gadgets (I tried shutting off about anything in the house), I guess all our neighbours bought themselves new plasma TVs. 🙁

I’ll spare you with a recording of that noise (not sure I even made one), but because some befriended OMs already requested it, here’s a recording of what SAQ can sound like, made by Manfred, DL6OBJ: grimetondez2012_dl6obj.ogg

So, what can we do to cope with the situation? Several possibilities come to mind:

  • Sue all those manufacturers of „noisy“ equipment (no chance of real success)
  • Move to a very rural area (not planning on doing so, soon)
  • Hack into the local power grid, causing a power outage for the time SAQ transmits (actually I like that idea, but it’s not only illegal, but also not as easy in reality as it looks like in Matrix)
  • Make your equipment portable and go outside (I’ll go with that one)

It has shown that it’s often sufficient to move a few kilometers away from any settlements. Also, getting up a hill or something like that might not be a bad idea, even though height is said to have little influence on VLF.
Most people would just take their stuff, get into their car and so exactly so, but since I have neither a car nor a driver’s license, it has to be even more portable for me. Wilfried, DJ1WF, has published a building description for a handheld VLF receiver I’m looking forward to solder myself: http://www.vlf.it/fritz/pocketrx.html

The results he’s achieving with such a small and simple device sound quite promising:

Hope I’ll be writing a more successful report after this year’s Alexanderson day!

Happy New Year!

Happy new year everyone!

It’s winter time and I have to concentrate on my study, but there’ll hopefully be some new articles in February or March (semester break).

When I just logged in I was shocked to find over 800 new comments – mostly, if not all spam, of course. I can’t possibly look through those amounts of comments regularly, and I’m not sure whether just activating a badword-filter will do the job sufficiently. Therefore, I disabled all comments until further notice.
If you have questions or additions to any article, you are however welcome to write me an e-Mail!