In: Categories » Computers and technology » Linux Commands » With the partitions created you need to put file systems on them
WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information.
[root@tedford /root]#
If you needed to write an /etc/fstab file yourself for this configuration, it would look something like this:
/dev/hdb1 / ext3 defaults 1 1
/dev/hdb2 swap swap defaults 0 0
/dev/hdb3 /usr ext3 defaults 1 2
/dev/hdb5 /home ext3 defaults 1 2
/dev/hdb6 /var ext3 defaults 1 2
/dev/hdb7 /tmp ext3 defaults 1 2
none /proc proc defaults 0 0
none /dev/pts devpts mode=0622 0 0
Making File Systems
With the partitions created, you need to put file systems on them. (If you’re accustomed to Microsoft Windows, this is akin to formatting the disk once you’ve partitioned it.) Under Linux, you use two tools for this process: mke2fs to create ext3 file systems, and mkswap to create swap file systems. There are many command-line parameters available for the mke2fs tool, many of which are needed only if you have an unusual situation. And if you have such an unusual need, I’m confident you don’t need this text for guidance on creating file systems! The only command-line parameter you’ll usually have to set is the partition onto which the file system should go. To create a file system on the /dev/hdb3 partition, you would issue the command
[root@tedford /root]# mke2fs -j /dev/hdb3
The -j parameter tells mke2fs that you want to set the file system up with a journal file; in other words, that this is an ext3 partition rather than an ext2 partition. Omit the -j, and you’ll create an ext2 partition instead.
NOTE
To convert the ext2 file system to an ext3 file system, run the command tune2fs –j /dev/hdb3 (of course, substituting your partition name for /dev/hdb3). To convert an ext3 file system to ext2, edit the /etc/fstab file so that the partition is listed as ext2, then unmount the partition and mount it again. Setting up swap space with the mkswap command is equally straightforward. The only parameter needed is the partition onto which the swap space will be created. To create swap space on /dev/hdb2, you would use
[root@tedford /root]# mkswap /dev/hdb2
To Journal, or Not to Journal?
In this project, you’ll be taking your very fine, very stable Linux system, and monkeying shamelessly with it. You’ll convert a partition from the default ext3 file system to the nonjournaling ext2 file system, and then convert it back. Do this on a test server that nobody else is using. You shouldn’t lose any data, but there’s no sense in taking any risks.
Step by Step
Exit the GUI on your Red Hat Linux 8.0 system and become the root user at a console prompt.
1. Look at the contents of your /etc/fstab file, and on a piece of paper, note the name of the partition on which /home is mounted. If you make a mistake in the text editor, you can restore the setting from your note.
2. Make sure nobody else is using the partition you plan to modify by running the fuser -v /home/* command.
3. Edit the /etc/fstab file and convert the file system type entry on the /home configuration line from ext3 to ext2. Save the file. It wouldn’t hurt to check again to see whether any users have snuck back on the system.
4. Unmount the file system on /home using the umount command.
5. Mount the file system on /home using the mount command.
6. You now have an ext2 file system instead of an ext3 file system. Try remounting the /home file system read-only and forcing an fsck to see how long the process takes.
7. Edit the /etc/fstab file again to set ext2 back to ext3.
8. Just telling the system that /home should have an ext3 file system isn’t enough; you must create a journal file for the file system. Use the tune2fs -j home_part command, where home_part is the device name of the partition you wrote down in step 2.
9. Check again for interloping users, and then remount the /home file system. You now have an ext3 file system again. Amuse yourself further, if you wish, by remounting the file system read-only and seeing what happens if you force an fsck on it.
Using Network File Systems
Network file systems make it possible for you to dedicate systems to serving disks while letting clients handle the compute-intensive tasks of users. Centralized disks mean easier backup solutions and ready physical security. Under Linux (and UNIX as a whole), disk centralization is accomplished through the Network File System (NFS). In this section, you’ll learn about client-side issues of NFS, leaving the server-side issues until later in this article (Linux tutorial 16).
legal notice
Our website is not responsible for the information contained by this article. Web-articles is a free articles resource.
Suggestion: If you need fresh, daily updated content for your website, feel free to use our service. Click here for more information.
Useful tools and features
related articles
Editing Text Files Editors are by the far the bulkiest of common tools, but they are also the most useful. Without them, making any kind of change to a text file would be a tremendous undertaking. Regardless of your Linux distribution, you will have gotten a few editors. You should take a few moments to get comfortable with them before you’re busy fighting another problem. NOTE Although all of the editors listed here come with Red Hat 8, not all of them are installed by default. ...
2. Reviewing Linux File System Standards
Reviewing Linux File System Standards One argument you hear regularly against Linux is that there are too many different distributions, and that multiple distributions lead to fragmentation. This fragmentation will eventuate in different, incompatible Linux versions. This is, without a doubt, complete nonsense that plays on “FUD” (Fear, Uncertainty, and Doubt). These types of arguments usually stem from a misunderstanding of the kernel and distributions. However, the Linux community has realized that it h...
3. Linux is built upon the foundation of file systems
File Systems Linux is built upon the foundation of file systems. They are the mechanisms by which the disk gets organized, providing all of the abstraction layers above sectors and cylinders. In this module, you’ll learn about the composition and management of these abstraction layers supported by the default Linux file system, ext2, and its more robust counterpart, ext3. This module covers the many aspects of managing disks. This includes creating partitions, establishing file systems, automating the process ...
4. Mounting and Unmounting Local Disks
Linux’s strong points include its flexibility and the way it lends itself to seamless management of file locations. Partitions are mounted so that they appear as just another subdirectory. Even a substantial number of file systems look, to the user, like one large directory tree. This characteristic is especially helpful to the administrator, who can relocate partitions to various servers but can have the partitions still mounted to the same location in the directory tree; users of the file system need not know abou...
5. The fsck tool short for File System ChecK
Using fsck The fsck tool, short for File System ChecK, is used to diagnose and repair file systems that may have become damaged in the course of daily operations. Such repairs are usually necessary after a system crash in which the system did not get a chance to fully flush all of its internal buffers to disk. (Although this tool’s name bears a striking resemblance to one of the expressions often uttered after a system crash, that this tool is part of the recovery process is strictly coincidence.) Us...
6. The process of adding a disk under Linux on the Intel
Adding and Partitioning a Disk The process of adding a disk under Linux on the Intel (x86) platform is relatively easy. Assuming you are adding a disk that is of similar type to your existing disks (e.g., adding an IDE disk to a system that already has IDE drives or adding a SCSI disk to a system that already has SCSI drives), the system should automatically detect the new disk at boot time, and all that is left is partitioning it and creating a file system on it. If you are adding a new type of disk (...
7. Mounting NFS partitions works much the same way as mounting local partitions
Mounting NFS Partitions Mounting NFS partitions works much the same way as mounting local partitions. The only difference is in how the partition is addressed. On local disks, partitions are addressed by their device name, such as /dev/hda1. In NFS mounts, partitions are referenced by their hostnames and export directories. Thus, if the server named ungerer is allowing your host to mount the directory /export/SL1200/MK2 and you want to mount this to /projects/topsecret1, you would use this command:...
8. Using autofs to mount partitions across the network
Starting the autofs Service Because the way you’re using autofs to mount partitions across the network relies on NFS, before using it you’ll need to be sure you can do normal NFS mounts. Once you have this working, just make a simple change to your startup scripts to deploy the autofs service. The easiest way to do this is to run the redhat-config-services utility to enable the daemon. Simply start the configuration tool and mark the autofs check box as shown. If you need to start autofs by hand...
9. Configuring Individual Partitions on Linux machines
Managing Quotas In any multiuser environment, you’re bound to run across users who—either refusing to play fair or because they’re oblivious to common courtesy—practice the fine art of disk hogging, taking up more than a reasonable amount of disk space. This problem can be managed in several ways. The first and most obvious solution is to beg and plead. This rarely works. The second approach is peer pressure: You regularly and publicly post the amounts of disk space being hogged by these users. If peop...
