I was recently faced with the task of scanning a lot of documents and wanted to preserve them as multi-page pdfs. Converting the raw jpegs to pdfs proved to be quite easy using ImageMagick's convert that I got from http://stackoverflow.com/questions/8955425/how-can-i-convert-a-series-of-images-to-a-pdf-from-the-command-line-on-linux. But, the file sizes of the pdfs was really large when using convert to create multi-page documents. A little bit of googling and I found pdfunite which was perfect and I was able to create reasonably sized multi-page pdfs from a set of single page pdfs :)
Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts
Thursday, October 04, 2012
Wednesday, June 23, 2010
Mounting VM images with multiple partitions
Of late, I have been playing around with the eucalyptus cloud project. I have a pretty basic setup with a single cloud-controller/cluster-controller and 2 nodes (using xen on centos 5.4). Usually the simplest way to mount a vm image file is as follows (find a more detailed description here)
$ # associate image file with a loop device $ losetup /dev/loop0 jaunty.img $ # create a mount point $ mkdir mnt $ # mount it :) $ mount -t ext3 /dev/loop0 mnt $ # chroot to navigate easily $ chroot mntThen I found the jboss CirrAS project that gives a vm image with a clustered jboss setup (both for ec2 and xen/kvm). So, out of curiosity I downloaded the images and since my eucalyptus cloud is operating in SYSTEM, I have to setup the vm instance such that it pings the CLC a few times so that the IP address gets updated. When I tried the tried and tested method above...boom nothing happened I kept getting
$ mount -t ext3 /dev/loop0 mnt
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
So, after some googling and some very helpful hints from #stormgrind turns out the CirrAS images have 2 partitions and if there are multiple partitions the loop device must be given an offset from which the actual image starts and the partition table ends :|. Thankfully mgoldmann in the irc channel suggested some sites that worked like a charm :)
$ # associate image file with a loop device with offset $ losetup -o 32256 /dev/loop0 back-end-sda.raw $ # create a mount point $ mkdir mnt $ # mount it :) $ mount -t ext3 /dev/loop0 mnt $ # w00tHow did I arrive at 32256? Simple. For images created by bximage you must use the value 32256 words of wisdom from here References http://bochs.sourceforge.net/doc/docbook/user/loop-device-usage.html http://varghese85-cs.blogspot.com/2008/11/mouting-partitions-with-losetup.html
Tuesday, June 22, 2010
iptables-fu
I've had a love hate relationship with iptables. I love the control it offers but, am quite confounded by all the low-level networking concepts at play. Today, I had to do some simple stuff, like blocking pings and block ssh from a particular IP. Here is my humble attempt at both
# reject all ping requests iptables -A INPUT -p icmp -j REJECT # drop all ssh (tcp:22) requests from 10.0.0.37 # DROP means that whoever is trying to connect from 37 will not get a connection refused...devious >( iptables -A INPUT -p tcp --sport 22 -s 10.0.0.37 -j DROP
Subscribe to:
Posts (Atom)