Mounting images that contain only one partition is rather easy. But how to mount image with multiple partitions? kpartx is the solution!
You can list all partitions within the image with
# fdisk -l /vm/dhcpd.img
Disk /vm/dhcpd.img: 0 MB, 0 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/vm/dhcpd.img1 * 1 127 1020096 83 Linux
kpartx can be used to create maps from the block devices
kpartx -a /path/to/xen/image.img
And those maps can be mounted as usual
mount -o rw /dev/mapper/loop0p1 /mnt/
Unfortunately, there is no way to pipe data directly to scp simply because scp can’t read from stdin. But you can abuse ssh to achieve the same result
tar cz a/dir | ssh user@remotehost.com "cat >outfile.tar.gz"
You can even do some funny things like
tar c /data/ | lzma -c -z |\
gpg --batch --force-mdc -ac -o - --passphrase-fd 3 -c 3< /etc/gpgpassphrase |\
ssh user@remotehost.com "cat >/data/backup.tar.lzma.gpg"
Simple question, simple answer:
// does this interval a intersect b?
public boolean intersects(Interval b) {
Interval a = this;
if (b.left <= a.right && b.left >= a.left) { return true; }
if (a.left <= b.right && a.left >= b.left) { return true; }
return false;
}
When designing a generic class which needs a parameter that is comparable you will probably end up with something like this:
public interface Page<K extends Comparable<K>>
public class LocalPage<K extends Comparable<K>> implements Page<K>
Unfortunately, using Comparable isn’t as “easy”. The Page interface described above can’t be instantiated for a type like java.sql.Time, which is not Comparable to itself, but to a supertype (i.e., java.sql.Time implements Comparable<java.util.Date>).
David Hall suggests: “If you’re going to declare types that implement Comparable, you probably need to be in the habit of writing the declaration as:”
public interface Page<K extends Comparable<? super K>>
public class LocalPage<K extends Comparable<? super K>> implements Page<K>
It was already quite some time ago that flashrom 0.9.0 was released by the coreboot-project developers, but anyway…
Flashrom is a utility for identifying, reading, writing, verifying and erasing flash chips. Since Fedora already contains flashrom, there is no need to compile it yourself. Simply pull it from the repo:
yum install flashrom
Usage is rather simple. For a list of all flags and options refer to the manpage. To check if you motherboard is supported, have a look at the coreboot wiki.
Currently, NXclient has some problems with handling the keyboard correctly on “newer” X-implementations (such as Fedora 10 and 11). Keys like the arrow keys or backspace are misinterpreted or don’t work at all.
A quick workaround to fix (at least most of) the keys
setxkbmap -model evdev -layout your_layout
on the server side.