Posts Tagged ‘bsd users’

How to mount MDF images in Debian GNU / Linux – What is the MDF and MDS file

Monday, February 27th, 2012

I’ve recently had to mount an MDF (.mdf) image file on my Debian Linux . I never used .MDF file extension before and therefore I had no clue what is this file extension, so I did a quick research in Google to educate myself what is the MDF file format?

What I found was one article on ehow.com titled What is MDF & MDS and one article in Wikipedia MDF and MDS file pair
In short MDF is a CD9660 like ISO format produced by some CD burning and image creation software like Alcohol 120%
An MDS file accompanies the .MDF file. The .MDS is an optional metadata descriptor file which explains what is contained in the .MDF (iso like file).
MDF is not so standartized format like the usual ISO‘s we use to snapshot optical CD or DVDs but still is produced by some programs.

The MDF and MDS file pairs are typically created by two famous MS Windows programs:

  • Alcohol 120%
  • Daemon Tools

Both of the softwares are non-free programs, with the little exception – Daemon Tools is at least a freeware.
This is the reason why MDF format is far from popular across GNU / Linux and BSD* users and mostly used across Microsoft Windows platforms.

On Windows there are plenty of program capable of reading and opening .MDF extension files; The two aforementioned programs + MagicISO is few of the many programs which support mounting / (Create virtual drive) for MDF files.

On Free Opearting Systems, (Linux / BSD) there are two GUI programs, that are capable of mounting MDF files;:

  • Furiusisomount
  • AcetoneISO

I’ve tried both of them, for the sake of testing. With FuriosIsoMount however mounting the MDF failed. I tried to mount with FuriousIsoMount by launching the program with both non-root and root privileges. The program was capable of detect the .MDF file, I can browse the file and even it appeared like it is mounting the MDF fine when pressing on Mount button, however the mount point directory stays empty.

With AcetoneISO program mounting the MDF directly was possible, but only when the program was run with root privileges. With non-root privileges I got the error:

Error, could not mount image.

AcetoneISO can't open MDF error message Debian GNU / Linux

There is also alternative way command way to mount an MDF image by;

1. Using mdf2iso to convert the MDF image file to ISO
2. Use the regular Linux mount command to mount the converted ISO9660 file

On Debian there mdf2iso is avaialable as a deb package.
To install it:

linux:~# apt-get install --yes mdf2iso

1. Convert MDF to ISO with mdf2iso

To convert the MDF image to ISO with mdf2iso cmd I used:

hipo@linux:~/mdf-iso$ mdf2iso my-mdf-iso-file.mdf
mdf2iso v0.3.1 by Salvatore Santagati
Licensed under GPL v2 or later
47% [: >=========:]

2. Mount the newly converted ISO file with mount cmd

linux:~# mkdir /mnt/ISO
hipo@linux:~/mdf-iso$ mount -t iso9660 -o loop my-mdf-iso-file.iso /mnt/ISO

Now your MDF will be mounted in /mnt/ISO 🙂

Convert single PDF pages to multiple SVG files on Debian Linux with pdf2svg

Sunday, February 26th, 2012

In my last article, I've explained How to create PNG, JPG, GIF pictures from one single PDF document
Convertion of PDF to images is useful, however as PNG and JPEG graphic formats are raster graphics the image quality gets crappy if the picture is zoomed to lets say 300%.
This means convertion to PNG / GIF etc. is not a good practice especially if image quality is targetted.

I myself am not a quality freak but it was interesting to find out if it is possible to convert the PDF pages to SVG (Scalable Vector Graphics) graphics format.

Converting PDF to SVG is very easy as for GNU / Linux there is a command line tool called pdf2svg
pdf2svg's official page is here

The traditional source way compile and install is described on the homepage. For Debian users pdf2svg has already existing a deb package.

To install pdf2svg on Debian use:

debian:~# apt-get install --yes pdf2svg
...

Once installed usage of pdf2svg to convert PDF to multiple SVG files is analogous to imagemagick's convert .
To convert the 44 pages Projects.pdf to multiple SVG pages – (each PDF page to a separate SVG file) issue:

debian:~/project-pdf-to-images$ for i in $(seq 1 44); do \
pdf2svg Projects.pdf Projects-$i.SVG $i; \
done

This little loop tells each page number from the 44 PDF document to be stored in separate SVG vector graphics file:

debian:~/project-pdf-to-images$ ls -1 *.svg|wc -l
44

For BSD users and in particular FreeBSD ones png2svg has a bsd port in:

/usr/ports/graphics/pdf2svg

Installing on BSD is possible directly via the port and convertion of PDF to SVG on FreeBSD, should be working in the same manner. The only requirement is that bash shell is used for the above little bash loop, as by default FreeBSD runs the csh. 
On FreeBSD launch /usr/local/bin/bash, before following the Linux instructions if you're not already in bash.

Now the output SVG files are perfect for editting with Inkscape or Scribus and the picture quality is way superior to old rasterized (JPEG, PNG) images