Monday, 30 January 2012

Linux Swap File vs Swap Partition


from http://en.wikipedia.org/wiki/Paging#Linux

Interesting piece on swap files from Andrew Morton himself.

.. "From a software point of view with the 2.6 Linux kernel, swap files are just as fast[14][15] as swap partitions. The kernel keeps a map of where the swap file exists, and accesses the disk directly, bypassing caching and filesystem overhead.[15]"

Q.) Does creating the swapfile on a journaled filesystem (e.g. ext3 or reiser) incur a significant performance hit?

A.) None at all. The kernel generates a map of swap offset -> disk blocks at swapon time and from then on uses that map to perform swap I/O directly against the underlying disk queue, bypassing all caching, metadata and filesystem code."

The implication is as follows: "With a 2.4.x kernel swap files were slower than swap partitions, but with the 2.6 kernel a swap file is just as fast as a swap partition."

Of course this depends on the following:

1.) That the swapfile is in contiguous space and therefore not fragmented
2.) That you have any need or desire to use a pagefile. Swap partitions work perfectly well.
3.) You're running a 2.6+ Kernel.

Tuesday, 10 January 2012

Microsoft DISM is rubbish

I've used this a few times and at first glance it seems like the mutts mahoonies. Microsoft have cracked it, awesome. It's built in to the O/S, it's powerful whats not to like. Quite a lot actually. Here are a list of my dislikes.

1.) It takes ages to unmount an image, even with discard. Surely this should take no time, there isn't anything to write to the image ?

2.) Shutting down a machine with a wim attached leaves stray stuff around that it's really difficult to delete. Even the cleanup-wim option seems confused.

3.) It somehow manages to screw up ntfs-3g in Linux. Nice. It's gotta be bad to mess up Linux.

Oh well.

Thursday, 13 October 2011

how to dd a disk and mount it's partitions

Blatantly cribbed from differing areas of the internet and shamelessly reproduced in a single place :-)

using dmesg find out the identity of your block device, in my case sdc (a 2gb flash drive)
copy it using dd
1.) dd if=/dev/sdc of=/root/02streak.dd
mount it using linux's excellent loopback driver
2.) losetup /dev/loop0 /root/o2streak.dd
use fdisk to show you the block offset of the partitions
3.) fdisk -lu /dev/loop0

Device Boot Start End Blocks Id System
/dev/loop0p1 23 3964463 1982220+ 5 Extended
/dev/loop0p5 46 500663 250309 83 Linux
/dev/loop0p6 500687 3964463 1731888+ 83 Linux

so offset for partition 5 is (512x46) 23552
offset for partition 6 is (512x500687) 256351744

4.) Flashy use of the mount command using the offsets for it to mount the correct location
mount -o loop,ro,offset=23552 -t ext3 /root/o2streak.dd /media/tmp/
mount -o loop,ro,offset=256351744 -t ext3 /root/o2streak.dd /media/tmp/

Jobs a goodun

Thursday, 13 January 2011

What am I currently up to ?

Things I'm currently doing are:
Organising my digital photo archive
updating my C.V.
scanning and doing OCR of all my business admin
ripping and encoding all my dvd's to either HD (Blu-ray) or DVD using handbrake.
ripping all my music
considering concepts to design a selfbuild house
setting up wireless N on dd-wrt on a linksys

Things I need to do:
learn more unix
learn more about regular expressions
learn a bit about cron
learn about SQUID

Saturday, 31 October 2009

Hamachi - upgrade, lose features !

I've been using Hamachi for ages and think it's great. I'm not so happy about the new client. No longer able to install as a service unless you're a premuim user ? I don't think so. I'll just keep using the old client, or find a different solution.

older version link http://www.oldversion.com/download_Hamachi_1.0.2.3.html

Monday, 28 September 2009

syslog-ng magic

Just has some help setting up my ubuntu machine to do syslog work for my Sky netgear router. I installed syslog-ng (as it seemed like a good idea) and help was from (http://www.linuxforums.org/forum/linux-networking/74063-router-syslog-entries-your-syslog-howto.html)

and the entries I changed/added to /etc/syslogng/syslog-ng.conf were:

source s_all {
udp();
};

destination routermsg { file("/var/log/router.log"); };
filter f_router {host(192.168.1.1);};

#netgear router
log {
source(s_all);
filter(f_router);
destination(routermsg);
};

Saturday, 25 July 2009

Serious about cutting your carbon footprint ?

One of the easiest ways is to reduce the population. I'm not talking genocide or anything, just get rid of child support and tax people a horrendous amount if they have more than 2 children.

Reduce the population, then there is less demand on the earth, more space, a better quality of living.

I suppose its unfair, but it is realistic.