Results 1 to 4 of 4

Thread: vitual disk

  1. #1
    eolei is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

    Default vitual disk

    i want to make a virtual disk in java and i don't know how.i have a model of a program and i have to write some methods.i have a video with some details.please contact me.vld_mxll@yahoo.com

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    you mean virtual disk within a java vm, such as using commons-vfs API and implementing your own back end, or such as using the FUSE module on Linux and implementing a Java based file system for the host sytem thru FUSE.?

  3. #3
    eolei is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

    Default

    i don't know.i have only a part of the program and a video that explains how it should work.this is the video YouTube - virtual disk java .
    if you can give me an email adress so i can send you my program. thanks for the help

  4. #4
    hotz is offline Member
    Join Date
    Jan 2011
    Posts
    1
    Rep Power
    0

    Default

    Yes ... to build a filesystem on a virtual disk.

    Java Code:
    Virtual disk interface is implemented and class proiect3.filesystem.DiskInterface proiect3.filesystem.Disk. This class has been implemented as an example of his methods contained and should not be rewritten.
    
                  Disk drive that contains the class and working methods of simulating it with this disc (formatting, reading, writing and finding the size).
                  A virtual disk is a two-dimensional array of bytes. The first dimension indicates the number of blocks (clusters) contained on the disk and the second dimension is the size of a block. For this simulator, will coincide with a block size of 1024 bytes and we assume that any block is composed of two sectors (a sector size is 512 bytes). The basic element is a disk block (not business!).
    Assuming that the disk size is size, creating a new disk will be made with the instruction:
    disk = new byte [size] [];
    In this way, the matrix is created but not initialized. disk is a one-dimensional array of objects and the memory will be allocated separately for each item. If we had said and the second dimension with a statement:
    disk = new byte [size] [BLOCK_SIZE];
    it would have been allocated size * BLOCK_SIZE bytes of memory and therefore can not be simulated disks with a size too big.
    This disk will be organized as a real disk and contains two zones: the zone system and data. Zone system is divided into the following areas:
    1. BOOT Zone
    2. FAT Area
    3. ROOT Zone
    After formatting, and size is set starting block for each zone and the zone system blocks are allocated and written environmental descriptor value (in our case, this descriptive will be 00 HEX, unlike a real disk where F6 HEX) .
    BOOT is on the first block area and will not be used. If the program is developed, this area may contain a program launch.
    Zone FAT (File Allocation Table) is table space allocation for files on disk. Each file is assigned a whole number of blocks (even if it occupies the entire space of the last block). This number is> = 1 for each file. The first block of the file is assigned to its creation. FAT entries will have a length of 32 bits (so that we can simulate the large disks). So each entry in the FAT occupies 4 bytes. Each block of data area is associated with an entry in the FAT (entry 1 corresponds to the first block of data, and so on). When creating a file / directory, find the first entry in the FAT content == Descriptor. This means that the corresponding block is not occupied by another file / directory. Block will be starting block of the file / folder. Entry from FAT will be written by -1 (FF FF FF FF), which is that it is the last block of the file / folder. When the first block of data space is exhausted, the search for a new entry in the FAT FREE. In the previous entry will be written against the new entry and new entry will be written -1, and so on.
    Since the FAT entries are 32-bit addresses can be stored in these large sizes to meet any existing HDD.
    ROOT area is the area where the data folders and files are written. Each entry in this area will have a length of 32 bytes and is organized as follows:
    - Byte 0 is the status byte. This byte can contain information on changing file / folder, etc.. If the file / directory is deleted, this byte will be written in HEX E5, without delete anything.
    - Bytes 1 to 14 will contain the file name / directory
    - Bytes 15-18 will contain the size (the size of all files directory can contain content (and not in subdirectories))
    - Bytes 19-20 will contain the date on which it was created / modified, codified by the formula: 32 * month + day + 512 * year;
    - Bytes 21-22 will contain the time at which it was created / modified, encoded by the relationship: sec / 2 + 32 * 2048 * hour + minute
    - Bytes 23-26 will contain the block index home
    - Byte 27 will contain the attributes of the file / folder (will be implemented following attributes: Read-Only (1) Hidden (2) Directory (16), Encrypt (64))
    - Bytes 28-31 will contain the index entry of the ROOT (such as directory) that contains the directory / file,
    When creating a file / directory, find a free entry into ROOT. An entry is free if its status byte is set E5 (a sign that was removed) or all its bytes are valued Descriptor. When formatting, the first entry is entered into ROOT ie ROOT directory entry. This directory will contain all other directories and files. Root directory can not be removed except by formatting.
    If a directory entry is the type (attribute byte has bit 5 set), data content of the entries will consist of 4 bytes containing ROOT indexes contained entries (files or directories).
    End of file (EOF) will be marked with (int) (-1) (ie FF FF FF FF).
    The area will be the first data will be sized and 95% of disk size for disks> 64 K and smaller for smaller discs. This percentage will be chosen so as to be room for all areas but at the same time, do not waste space. BOOT begins with block 0. FAT starts with a block. Number of entries in the FAT must be> = number of data blocks in the area. So we know the size of the FAT and therefore know the area starting block ROOT. ROOT area size is obtained by difference. Therefore, we get home and block data area.
    The project is to implement the package proiect3.filesystem interfaces. (Read sources classes and interfaces in this package). A uniform approach, was constructed Console class.
    Last edited by hotz; 01-06-2011 at 12:23 AM.

Similar Threads

  1. Copy files within JAR to disk
    By RaF in forum New To Java
    Replies: 2
    Last Post: 08-31-2010, 04:25 PM
  2. Retrieve Image From Hard Disk
    By sayan751 in forum AWT / Swing
    Replies: 3
    Last Post: 02-20-2009, 03:29 PM
  3. Getting disk label
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-05-2008, 09:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •