#!# Using virtual disks //FreeBSD

Discussion in 'Archives' started by 1ce, May 14, 2011.

#!# Using virtual disks //FreeBSD
  1. Unread #1 - May 14, 2011 at 3:51 AM
  2. 1ce
    Joined:
    Mar 11, 2011
    Posts:
    261
    Referrals:
    1
    Sythe Gold:
    0

    1ce Forum Addict
    Banned

    #!# Using virtual disks //FreeBSD

    Greetz all, today I'll be showing you how to use your system's resources for using your own virtual disks.

    In this guide I'll show you how to use your systems memory disk configuration to mount the file system in a *.iso image. A buddy has my --game-iso drive so some pics may have to wait. mdconfig is included in your OS resources so there is no installation needed.

    BEFORE READING::
    Commands starting with '#' must be done as super user.
    Commands starting with '$' must be done as a regular user.

    <guide>

    First of all, you need a *.iso file to mount. If you'd like to try it out with while you read this guide I suggest you get one. I'll also be writing guides on using alternate system resources such as burncd. These resources will allow for you to burn cds/dvds WITHOUT having to download/install software. (also lets you load a game disk into your pc and rip/convert it to an *.iso image).

    First let's look at the man pages for mdconfig so I can show you some of it's useful switches::

    The -a switch will attach a device, you can combine this with the -u switch to hand select the device number or use use -a by itself and have them be created in sequential order. I.E. 0, then 1, then 2, and so on.

    The -d switch will detach a device, exactly the opposite of -a; it will detach and release the respective resources associated with the device. You will also use the -u switch with it.

    The '-u' switch allows you to hand select the devices, rather than it being automatically handled by mdconfig. This is useful for telling mdconfig to remove a device.

    The -t switch followed by it's argument specifying the type of disk storage you're trying to use. We will be using vnode, so we will also need to use the -f switch to specify the file we wish to be using.

    I.E. -t vnode-f /path/to/file.whatever

    Also, to help you keep track of the devices you've created, u can use the '-l' switch to list them. As well as the -v switch (for verbose) to grab some more detailed information. This is handy when using multiple vdisks. An example of this is:

    #mdconfig -l -v

    Right,.. so now to mount the *.iso file you wish to use as a vdisk. To do so do the following:

    # mdconfig -t vnode -f /path/to/your/file.iso

    What this does, is it creates a mountable device from your iso file. As I said before you can use the -u switch to create the device number you wish to use. Another example:

    # mdconfig -t vnode -f /path/to/your/file.iso -u 5

    And that will create the device md5 rather than md0 as would have normally been done. (provided md0, md1, md2, md3, and md4 didn't already exist.)

    Now that the device has been created, you need to mount the device. To do so, you need to specify that the file is an iso-9660 format. The argument for 'mount' that FreeBSD uses is cd9660, so using the -t switch for mount, we will specify that as our type.

    Now that we have a base understanding, here are the steps used to create/mount/remove our virtual disk.

    # mdconfig -t vnode -f /path/to/your/file.iso
    # mount -t cd9660 /dev/md0 /mnt (or whever you wish to mount it instead)

    That will create a mountable device, then mounts it where you wish. Then to remove it:

    # umount /dev/md0
    # mdconfig -d -u md0

    That will unmount the device's file system from your system and the second command detaches whichever device you need it to.

    Notice: I used md0 as an example, your situation could be md5, or even md9001 if you specified the number with -u or have multiple disks open.

    </guide>

    Right, for the next part of this guide I'll show you how to do virtual disks so that you can now play games. All of the above steps apply, but for this guide we need to get a copy of wine.

    For i386 users you can get a copy of it here:
    # cd /usr/ports/emulators/wine ; make install clean

    For a64 users, follow these steps:
    # wget http://people.freebsd.org/~ivoras/wine/wine-fbsd64.8-1.3.6,1.tbz
    # pkg_add wine-fbsd64.8-1.3.6,1.tbz (seriously just hit <tab> after the first 2 or 3 letters)

    Right, now make a virtual disk of the *.iso image you wish to add.


    [​IMG]

    Here you see where I created the device, which told me what it was (md0); then I mounted it to /mnt2, (a good place for you is probably /mnt, but you can just dump it wherever) and all the files are there. Now we just tell wine to use that directory as a disk. So now do:

    $ winecfg

    After that, go to the mountpoint of your md* device, and click on the drop down for types of devices, and select cd. It's under 'Drives' tab, you will probably need to create a new drive, so do that. Now click advanced, under type select cdrom. Then find the path you mounted the md* device to and close winecfg.

    [​IMG]

    Great, now cd to that directory, then invoke wine with the application you wish to run.

    [​IMG]

    That's everything. If you're new to unix, using shell utilities can be a little interesting and new. For more experienced users this guide should be very simple. In either case, it's pretty straight forward. Just remember to umount the device when you're finished.

    Salutations, and farewell. 1ce
     
< . | Home Internet Marketing Business ABCs >

Users viewing this thread
1 guest


 
 
Adblock breaks this site