Nathan Shearer
Kernel Seeds Update

I've uploaded a new version of my kernel seeds that has been tested against vanilla-sources-3.14.25 on three different architectures:

  • x86
  • x86_64
  • arm
Kernel Seeds

Some of you might have heard about the kernel seeds that I use to configure my Gentoo systems and I though it is something you might find handy when building your own kernels, so I've decided to post it here for you to use. Let me know how it works out for you and if there are any features you would like added to the kernel that I might have missed.

Moving from RAW to QCOW2

Initially I created a few virtual machines as RAW images because I needed the performance advantage that RAW images had over QCOW2 images. Some of the recent performance improvements to QCOW2 have now made it worth it for me to switch from RAW to QCOW2. I have a few Windows virtual machines formatted with NTFS and I would like to take advantage of the fact that QCOW2 does not consume space to store empty sectors. But with these filesystems being relatively old the unused sectors are now mostly filled with random data. Fortunately the ntfsprogs package has a utility called ntfswipe which can wipe unused sectors! That's exactly what I need...

First I shut down the virtual machine with:

# /etc/init.d/qemu.vm-name stop

Then I create a backup of the RAW 25GB image.bin file. Always backup important data before you modify it!

# cp /home/virtual/vm-name/image.bin /home/virtual/vm-name/image.bin-backup

Now that we have a full backup I examine the partition table. I need to know where the filesystem begins:

# fdisk -lu image.bin

Disk image.bin: 26.2 GB, 26214400000 bytes
255 heads, 63 sectors/track, 3187 cylinders, total 51200000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa41da41d

    Device Boot      Start         End      Blocks   Id  System
image.bin1   *          63    51183089    25591513+   7  HPFS/NTFS/exFAT

This particular machine has only one partition and it starts on the 63rd sector. At 512 bytes per sector we can determine which byte the partition begins at 512*63 = 32256. So now I can use losetup to isolate the filesystem:

# losetup -o 32256 -f image.bin
# losetup -a
/dev/loop0: [0902]:40108049 (/home/virtual/vm-name/image.bin), offset 32256

Now I can use ntfswipe to erase the unused sectors:

# ntfswipe -uv /dev/loop0
ntfswipe is about to wipe:
        unused disk space

ntfswipe will overwrite these areas with: 0x00


ntfswipe will begin in 5 seconds, press CTRL-C to abort.

wipe_unused 0x00, 16120442880 bytes
16120442880 bytes were wiped

Delete the loopback device:

# losetup -d /dev/loop0

And convert the image from RAW to QCOW2. The QCOW2 image format will automatically ignore the sectors that were erased in the last few steps. My hard drives have 4096 byte physical sectors with 4096 byte RAID clusters with 4096 byte ext4 clusters. So I will set the QCOW cluster size to 4096 bytes too (for maximum performance).

# qemu-img convert -f raw -O qcow2 -o cluster_size=4096 image.bin image.qcow2

Now that you have a much smaller QCOW2 image all you need to do is update the /etc/conf.d/qemu.vm-name config file to use the new image and enjoy the extra features offered by the QCOW2 format. After all these steps were completed my 25GB image shrank to 8.8GB.

IPv6 on Gentoo

I successfully established IPv6 connectivity on my Gentoo system today using the tunnel broker provided by Freenet6 with their gateway6 client. I'm still experimenting with it to see how persistent my IPv6 address will be but I suspect I will be able to create a decentralized filesystem for backing up my important documents without too much effort.

The process to get it working was extremely simple (after the lengthy research was completed):

  1. Install the gateway6 client. On gentoo that's a simple "emerge gateway6" (unmask it if you need to)
  2. Start the gateway6 client. On gentoo it is located at /etc/init.d/gw6c
  3. Enjoy your 10/10 score at test-ipv6.com

I'm curious how many nodes I will need to create 1GB of satisfiably redundant storage. With that knowledge I should be able to scale it up to a few TB and benchmark the whole setup. I suspect the latency will be horrible but good enough for archival purposes.

Samsung CLP-310N on Linux with CUPS

Samsung says the printer is supported. Over one "computer eon" ago I installed it on my Dad's Ubunto machine and it was a fairly painless installation -- but I forgot all the details since then (sorry). Installing it on Gentoo in CUPS (without using Samsungs installer) was a bit more complicated.

First I assigned the printer a persistent IP on my network with dnsmasq. That step is fairly straight forward as it's the same process for any network printer. The only approach that resulted in a non-corrupted test page involved using Samsungs PPD file in their linux driver download and manually copying the files from the Samsung download that CUPS complained were missing as I printed test pages. The higher quality modes tried to work, but failed with some kind of interlacing artifact. The draft mode did work.

I will have to settle for draft mode for now. The printer claims to support 2400x600 DPI and getting that to work will probably involve hacking my own PPD file...

 

*Update

I've discovered that the foo2qpdl project has support for this printer and that it exists in portage! I emerged foo2qpdl with emerge net-print/foo2zjs and setup the printer with IPP and the PPD file provided by foo2qpdl. I set the print quality to the best I could (1200x1200) and it worked (in colour and greyscale)!

% Powered by Modulus %
© 2016 Nathan Shearer