Archive for May, 2007

Web server address - Chapter 3 . Partitions, Filesystems, and Files 91

Tuesday, May 8th, 2007

Chapter 3 . Partitions, Filesystems, and Files 91 user to mount and reliably read and write to VFAT filesystems, which is especially convenient if you are using a machine that can boot both Linux and Windows. SUSE Linux is usually quite good at finding a Windows installation and, depending on its support for the version of NTFS used on your disk(s), will create a mount point for your Windows filesystems so that you can access your files while running Linux. Creating Filesystems As you can see from the previous sections, the choice of filesystems provided by Linux is quite large, and they all perform relatively well. A journaling filesystem is always recommended when quick restart times and maximized data integrity are significant factors, and the ReiserFS, EXT3, JFS, and XFS are all excellent filesystems to consider. In enterprise environments, optimizing data access and creation times are especially significant features, with both XFS and JFS providing potential performance advantages, especially when creating large files. For home users, getting the most out of your storage devices is often a primary concern, in which case ReiserFS is a good choice. If you want to migrate existing EXT2 filesystems to Linux or are simply concerned about having the richest possible set of diagnostic and debugging tools, the EXT3 filesystem is probably your best choice. Those of you familiar with other forms of Unix will be expecting to find mkfs scripts to create new filesystems. As Linux is a form of Unix, it does indeed use the notion of mkfs to create new filesystems. On Linux systems, the mkfs program is actually a wrapper for filesystem-specific versions of mkfs, which have names such as mkfs.ext2, mkfs.reiserfs, and so on. When you execute the mkfs command, you must specify the type of filesystem that you want to create using the -t (type) option, which the mkfs command then uses to locate the version of the mkfs command that will create the specified type of filesystem. The following list shows the filesystem-specific versions of mkfs that are found on a standard SUSE system: # ls -1 /sbin/mkfs* /sbin/mkfs /sbin/mkfs.bfs /sbin/mkfs.ext2 /sbin/mkfs.ext3 /sbin/mkfs.jfs /sbin/mkfs.minix /sbin/mkfs.msdos /sbin/mkfs.reiserfs /sbin/mkfs.vfat Having already created partitions to house our filesystems earlier in this chapter, we can now use these to experiment with different types of filesystems. The next few sections show how to create different types of journaling filesystems and provide some guidance on mounting and using these types of filesystems.
Note: If you are looking for best quality webspace to host and run your tomcat application check Vision personal web hosting services

90 Part I . SUSE Linux Basics JFS (Business web site)

Tuesday, May 8th, 2007

90 Part I . SUSE Linux Basics JFS also makes clever use of filesystem data structures such as the inode (information node) data structure that is associated with each single file or directory in the filesystem. At least one inode exists for every file in the filesystem, but JFS creates them only when files and directories are created. In traditional filesystems, the number of inodes (and thus the number of files) on a filesystem was dictated at filesystem creation time. This could lead to a situation in which no more files could be created because there was nowhere to store information about the file. Creating inodes as files and directories means that a JFS filesystem can contain an essentially unlimited number of files and allows a JFS filesystem to be scalable in the traditional sense. As JFS is a 64-bit filesystem, it is also able to allocate space for extremely large files, unlike existing 32-bit filesystems that can create files only up to 4GB in size because of addressing issues. XFS XFS is SGI s high-performance 64-bit filesystem, originally developed for use with its IRIX operating system. SGI machines have traditionally had to work with large data sets on machines with many processors, which is reflected in the way that XFS works. One of the best features of XFS is that it offers independent domains of data across the filesystem. This allows a multiprocessor system to access and change data in different allocation groups independently of each other. This also means that instead of a single write happening to the filesystem at one time, multiple reads and writes can take place at the same time. This provides a significant performance boost for enterprise level data storage. This may not sound like something that would work in the traditional sense of a single disk on a home PC, but if you have a storage area network in which multiple data streams are provided by many disks, the idea works very well. Like ReiserFS, XFS uses its journal to store information about file metadata and employs binary trees to handle allocation of data. An added feature of XFS is that it also uses a binary tree to store information about free space. This helps speed up block allocation for new information. As you would expect from a filesystem originally developed for machines that process huge amounts of multimedia data, XFS is especially good at allocating and managing huge files. XFS is truly an enterprise filesystem and may not prove overwhelmingly attractive for a home user, but for large amounts of data and high-end machines, it really is an excellent choice. VFAT/NTFS Virtual File Allocation Table (VFAT) and New Technology File System (NTFS) are the Microsoft filesystems that are found in Windows 98/95, NT, and 200x operating systems. NTFS filesystems are readable by Linux systems, although writing NTFS filesystems is a recent addition to the Linux kernel that is still being developed and debugged. Support for the VFAT filesystem is quite stable in Linux and enables a
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision web and email hosting services

Chapter 3 . Partitions, Filesystems, and Files 89 (Web design)

Tuesday, May 8th, 2007

Chapter 3 . Partitions, Filesystems, and Files 89 ReiserFS The ReiserFS filesystem was mentioned earlier; this section provides more in-depth information about its advantages and capabilities. ReiserFS is one of the most stable Linux journaling filesystems available. Although occasional problems have surfaced in the past, the ReiserFS filesystem is widely used, and problems are therefore quickly corrected. ReiserFS does not allocate and access files in the traditional block-by-block manner as do other filesystems such as EXT2, but instead uses a very fast, balanced b-tree (binary tree) algorithm to find both free space and existing files on the disk. This b- tree adds a simple but elegant mechanism for dealing with small files (files that are smaller than the filesystem block size, generally 4 kilobytes) in ReiserFS. If a file is smaller than a filesystem block, it is actually stored in the binary tree itself instead of being pointed to. Retrieving the data for these files therefore takes no more time than is required to locate them in the b-tree, which makes ReiserFS an excellent choice for filesystems in which large numbers of small files are constantly being created and deleted, such as mail directories or mail servers. ReiserFS also provides other optimization that can lead to dramatic space savings compared to traditional filesystems. When a file is stored on a filesystem, filesystem blocks are allocated to actually store the data that the files contain. If you had a block size of 4K, but wanted to store a file of 6K on the disk, you would be wasting 2K of disk space because a block belongs to one file only and in this case you would have to occupy two, wasting 2K and therefore not optimally using the space. ReiserFS can also store these fragments in its b-tree by packing them together, which provides another way of minimizing disk space consumption in a ReiserFS filesystem. Later in the chapter, we look at some published benchmarks comparing filesystems in different situations. JFS JFS is a port of IBM s Journaling Filesystem to Linux. JFS was originally developed for IBM s OS/2 operating system and later adapted for use as the enterprise filesystem used on its pSeries/AIX-based systems. IBM released the source code for JFS to the open source community in 2000 and has actively participated in the continuing development and support of this filesystem for Linux since that time. JFS is similar to ReiserFS in that it uses binary trees to store information about files. JFS is heavily based on transactions, in much the same way that databases are, using these as the basis for the records that it maintains in its journal. JFS provides a very fast method of data allocation based on extents. An extent is a contiguous series of data blocks that can be allocated, read, written, and managed at one time.
Note: If you are looking for high quality webhost to host and run your jsp application check Vision florida web design services

88 Part I . SUSE Linux Basics hour (Web host sites)

Monday, May 7th, 2007

88 Part I . SUSE Linux Basics hour or two. Journaling filesystems introduce a small overhead for all write operations, but the greater assurances of data consistency and the fact that modern drives are very fast make them an attractive choice for use on most modern Linux systems. There are certain situations where the use of a journaling filesystem can be a bad idea most notably with databases that store their data in a standard Linux filesystem but that keep their own log of changes to those data files and are able to recover data using their own internal methods. Oracle is a good example of a database that provides its own methods to guarantee the consistency of its data files. EXT2 EXT2 has been the de facto Linux filesystem for many years and is still used for initial ramdisks and most non-journaling filesystems. Because of its age, EXT2 is considered extremely stable and is quite lightweight in terms of overhead. The downside to this is that it does not use any journaling system to maintain integrity of data and metadata. EXT3 EXT3 is a journaling version of the EXT2 filesystem discussed in the previous section. It adds a journal to the EXT2 filesystem, which can be done to an existing EXT2 filesystem, enabling easy upgrades. This is not possible with other journaling filesystems because they are internally very different from other existing filesystems. EXT3 provides three journaling modes, each of which has different advantages and disadvantages: . journal Logs all filesystem data and metadata changes. The slowest of the three EXT3 journaling modes, this journaling mode minimizes the chance of losing the changes you have made to any file in an EXT3 filesystem. . ordered Logs only changes to filesystem metadata, but flushes file data updates to disk before making changes to associated filesystem metadata. This is the default EXT3 journaling mode. . writeback Logs only changes to filesystem metadata but relies on the standard filesystem write process to write file data changes to disk. This is the fastest EXT3 journaling mode. Beyond its flexibility and the ease with which EXT2 filesystems can be converted to EXT3 filesystems, another advantage of the EXT3 filesystem is that it is also backward compatible, meaning that you can mount an EXT3 filesystem as an EXT2 system because the layout on disk is exactly the same. This enables you to take advantage of all the existing filesystem repair, tuning, and optimization software that you have always used with EXT2 filesystems should you ever need to repair an EXT3 filesystem.
Note: In case you are looking for affordable webhost to host and run your web application check Vision http web server services

Chapter 3 . Partitions, Filesystems, and (Tomcat web server) Files 87

Monday, May 7th, 2007

Chapter 3 . Partitions, Filesystems, and Files 87 To provide access to a wide range of different types of filesystems, Linux provides a general method that is easily extended. Linux provides a virtual filesystem (VFS) layer that a filesystem driver hooks into to provide file-based access to information. Whether it is listing the files in a directory, reading the data from a file, or providing other functionality such as direct file access (not using the filesystem buffers), VFS and the filesystem driver provide a uniform application program interface (API) to deal with files in different types of filesystems. This is nothing new, and Unix and all other operating systems that support multiple filesystems provide this virtual filesystem interface in one way or another. When you have created partitions, you must usually create a filesystem in that partition to make use of the newly allocated space. Many different types of filesystems are available for this purpose, but this section focuses on types of filesystems that are available out of the box with SUSE Linux. The most common and preferred filesystem used with SUSE is the Reiser filesystem (ReiserFS). ReiserFS was the first stable incarnation of a journaling filesystem on Linux. The development of ReiserFS was partly funded by SUSE as they realized that enterprise class storage (at least large storage pools) needed a journaling filesystem. What Is a Journaling Filesystem? A journal, with respect to filesystems, is an area of the disk that is used to store information about pending changes to that filesystem. Filesystems contain two general types of infor- mation: the actual files and directories where your data is stored, and filesystem metadata, which is internal information about the filesystem itself (where the data for each file is physically stored, which directories contain which files, and so on). When you write to a file in a journaling filesystem, the changes that you want to make are written to the journal rather than directly to the file. The filesystem then asynchronously applies those changes to the specified file and updates the filesystem metadata only when the modified file data has been successfully written to the file in question. Journaling helps guarantee that a filesys- tem is always in a consistent state. When you reboot a Linux system, Linux checks the con- sistency of each filesystem (using a program called fsck, for file system consistency check) before mounting it. If a filesystem requires repair because its consistency cannot be verified, the fsck process can take a long time, especially on larger disks. Enterprise systems tend to require journaling filesystems to minimize the time it takes to restart the system because downtime is generally frowned upon. Historically, the most popular Linux filesystem is EXT2, which is a fast, simple filesystem that does not have a journaling feature. When a system that uses EXT2 filesystems crashes, the EXT2 metadata must be scanned thoroughly and compared to the data that is actually on the disk to correct any chance of data corruption. On a large system, this consistency check can take at best minutes and at worst an
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision ecommerce web hosting services

86 Part I . SUSE Linux Basics Changing (Make web site)

Monday, May 7th, 2007

86 Part I . SUSE Linux Basics Changing Partition Types As you can see from the output of fdisk-l and the p command in fdisk in the preceding sections, there are a variety of different types of partitions. Linux, Linux swap, and Extended all refer to a specific type of partition. Many operating systems, including Windows and Linux, have different types of partitions. The most common ones that every Linux system uses are the Linux (type 83 in fdisk) and Linux swap (type 82 in fdisk) types. Linux handles partitions of different types in different ways. Any Linux filesystem you create on a partition must be created on a partition whose type is Linux (type 83). The swap partition must be of type Linux swap. When creating partitions, type 83 is the default partition type for all physical or logical partitions. If you want to create a partition of a different type, you must create it (using fdisk or YaST) and then modify its type. Why would you want to do this? You may want to create a partition of a different type if, for example, you are adding a new disk to a system that can boot both Linux and another operating system and you want to use a portion of your new disk as a standard partition for that other operating system. For example, Linux knows about Windows partition types, but Windows does not know about Linux partition types, so you would want to partition the disk using Linux but then format the Windows partition under Windows. Linux recognizes (and can access) an incredible number of different types of partitions, which enables you to use fdisk to create disks that you can share with a wide range of other types of computer systems. To change the type of a partition in fdisk, use the tcommand and enter the number of the partition that you want to modify. You will then be prompted for the type of partition that you want to change the partition to. This prompt takes a hexadecimal number as a type; you can view the list of available partition types by entering L when prompted for the hex code for the new partition type. Filesystems Filesystems provide a base for your files to be stored on the physical disk. A good analogy is that a disk is like the building that houses your local library, while the filesystem is its infrastructure the shelves that hold the books and the card catalog that enable you to find a particular title. Linux supports many different types of filesystems, each of which has its own internal structure and access methods. To access a specific type of filesystem, Linux uses kernel software known as a driver that understands the internal structure of a specific filesystem. If you are trying to read a disk from another type of system, Linux might also need to load additional drivers to be able to interpret the disk partition tables used by some types of disks and associated filesystems.
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision best web hosting services

Chapter 3 . Partitions, Filesystems, and Files 85 (Web hosting company)

Monday, May 7th, 2007

Chapter 3 . Partitions, Filesystems, and Files 85 Units = cylinders of 1008 * 512 = 516096 bytes Device Boot Start End Blocks Id System /dev/hda1 1 1041 524632+ 82 Linux swap /dev/hda2 * 1042 7283 3145968 83 Linux /dev/hda3 7284 11445 2097648 83 Linux /dev/hda4 11446 15321 1953504 5 Extended /dev/hda5 11446 11834 196024+ 83 Linux Command (m for help): Enter n to create a new partition. Because you have used up all the primary partitions you can on the disk and now have one extended partition, fdisk is clever enough to realize that you cannot create a primary partition, and therefore automatically determines that you can create only a logical partition within the empty extended partition. Although you have the ability to create many more partitions, this example simply creates a small logical partition of 200MB for a test filesystem. Printing out the partition table now shows you five partitions. The Extended partition cannot store data or be accessed by Linux as anything but a container for logical partitions. Updating a Disk s Partition Table After you have created a partition, you need to save the updated partition table for your disk. As mentioned before, do not do this on a live system unless you are allocating previously unused space. If the disk you are working on is currently in use (as may well be the case on a small home machine), then the partition table will be saved but cannot be reread by Linux. To solve this problem, you need to reboot your machine. If you were partitioning a disk that was not in use (no filesystems mounted), then saving and rereading the table will work without a problem. Listing 3-5 shows the q (quit) command in fdisk, followed by messages from fdisk indicating that the system must be forced to update its idea of the disk s partition table. Listing 3-5: Saving the Partition Configuration Command (m for help): q The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot. Syncing disks. bible:~ #
Note: If you are looking for best quality webspace to host and run your tomcat application check Vision virtual web hosting services

84 Part I . SUSE Linux Basics To (Web server certificate)

Sunday, May 6th, 2007

84 Part I . SUSE Linux Basics To create a partition, press n(new partition). After entering n, fdisk prompts you for the type of partition that you want to create: p(for primary) or e(for extended). As you already have three partitions, creating an extended partition will use all of your available primary partitions. However, as you are creating an extended partition, you can add more logical partitions when needed. After entering eto create an extended partition, fdisk prompts you with a suggested value for the starting cylinder for the new partition. This is always the first available cylinder on the disk the first cylinder that is not already allocated to an existing partition. Unless you have a specific reason not to do so, you should always accept the suggested first cylinder by simply pressing Return to accept the default value (shown in Listing 3-3 as , for carriage return). Next, fdisk prompts you for the size or ending cylinder of the partition that you are creating. You enter +2G to show that you want to create a 2GB partition, at which point the fdisk prompt redisplays. After entering pto print the new partition map, you can see that you have created a 2GB-sized extended partition. This enables you Caution to create logical partitions within it totaling no more than 2GB collectively. As mentioned previously, it is safe to experiment with fdisk on your primary system as long as you never write out the updated partition table. When you start fdisk, it creates an in-memory copy of the partition map for the specified disk and makes all of its changes there. It never updates your disk until you actually issue the w (write) command. Never issue the write command in fdisk unless you want to save your changes and update your disk s idea of its partitions. This can usually be undone, but if you have accidentally updated the partition table for your system s boot drive, and have changed any existing partition definitions, your system may well crash the next time that it tries to read from disk. If you accidentally save an updated partition table, you may be able to recover by booting from a rescue disk and manually recreating the old partition table within fdisk before you attempt to check the consistency of the drive (by using fsck). Unfortunately, this is impossible to guarantee, so be very careful when experimenting with fdisk. Now, let s go ahead and create a logical partition to hold a filesystem, as shown in Listing 3-4. Listing 3-4: Creating a Logical Partition Command (m for help): n First cylinder (11446-15321, default 11446): Using default value 11446 Last cylinder or +size or +sizeM or +sizeK (11446-15321, default 15321): +200M Command (m for help): p Disk /dev/hda: 16.1 GB, 16105807872 bytes 16 heads, 63 sectors/track, 31207 cylinders
Note: If you are looking for cheap webhost to host and run your apache application check Vision jboss web hosting services

Chapter 3 . Partitions, Filesystems, and Files 83 (Net web server)

Sunday, May 6th, 2007

Chapter 3 . Partitions, Filesystems, and Files 83 system by directly querying its BIOS for a specific coordinate on the disk expressed in terms of a cylinder, head, and sector address. With space being at a premium in the old days, the amount of space allocated to actually store those coordinates was very low (10 bits). For those of you who haven t done some binary math in your head, that equates to a total of 1,024 possible addresses on the disk, and this is the problem fdisk is telling us about. DOS is an OS that is therefore unable to handle these larger disks, and even the Linux LILO boot loader had this limitation until a few years ago. It is unlikely that this limitation will affect you as most modern computer BIOSes have resolved these issues. After starting the fdisk command and seeing any introductory messages, you are presented with its internal prompt, Command(m for help):. We issued the pcommand to print out the partition map. This produces the same output as the fdisk -l command, but only for the disk specified on the command line (/dev/hda). The following example shows how to create an extended partition and logical partitions within it. Listing 3-3 shows a transcript of this fdisk session, with our sample responses highlighted in bold. Listing 3-3: Creating an Extended Partition Command (m for help): n Command action e extended p primary partition (1-4) e Selected partition 4 First cylinder (11446-31207, default 11446): Using default value 11446 Last cylinder or +size or +sizeM or +sizeK (11446-31207, default 31207): +2G Command (m for help): p Disk /dev/hda: 16.1 GB, 16105807872 bytes 16 heads, 63 sectors/track, 31207 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Device Boot Start End Blocks Id System /dev/hda1 1 1041 524632+ 82 Linux swap /dev/hda2 * 1042 7283 3145968 83 Linux /dev/hda3 7284 11445 2097648 83 Linux /dev/hda4 11446 15321 1953504 5 Extended Command (m for help):
Note: If you are looking for cheap webhost to host and run your apache application check Vision apache web hosting services

82 Part I . SUSE Linux Basics What (Web host 4 life)

Sunday, May 6th, 2007

82 Part I . SUSE Linux Basics What Does fdisk Really Do? The fdisk command displays and modifies the partition table, often referred to as the partition map, for one or all disk drives. The partition table is stored on disk and is just a list of the cylinders, sectors, and blocks associated with each existing partition on the disk. When you start fdisk in interactive mode, it reads your disk s partition table into memory and enables you to make changes to that in-memory copy. Changes to the partition table are not actually written back to the disk until you explicitly use the w (write) command to do so. Do not issue the w command unless you are absolutely sure that you want to update a disk s partition map. So let s go ahead and load fdisk with /dev/hda as the disk we will be working with (see Listing 3-2). (We re using a different disk in the following examples from the one we used in Listing 3-1, so don t worry about the discrepancy between this listing and the previous fdisk-l example.) Listing 3-2: Using fdisk to Edit /dev/hda bible:~ # fdisk /dev/hda The number of cylinders for this disk is set to 31207. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): p Disk /dev/hda: 16.1 GB, 16105807872 bytes 16 heads, 63 sectors/track, 31207 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Device Boot Start End Blocks Id System /dev/hda1 1 1041 524632+ 82 Linux swap /dev/hda2 * 1042 7283 3145968 83 Linux /dev/hda3 7284 11445 2097648 83 Linux Command (m for help): As you can see in the preceding listing, fdisk presents you with a warning about the size of the disk. The warning relates to older systems and disks and is not especially relevant these days. Older operating systems used to talk to the disks in a
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision mysql5 web hosting services