[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
slackbook:working_with_filesystems [2012/09/09 22:49 (UTC)] – [The Filesystem Hierarchy] Added original text with formatting mfillpot | slackbook:working_with_filesystems [2012/09/09 23:01 (UTC)] – [Sources] Updated the suthor names and tags mfillpot | ||
---|---|---|---|
Line 37: | Line 37: | ||
===== Local Filesystem Types ==== | ===== Local Filesystem Types ==== | ||
- | The Linux kernel supports a wide variety of filesystems, | + | The Linux kernel supports a wide variety of filesystems, |
+ | you to choose from a long list of features to tailor to your particular | ||
+ | need. Fortunately, | ||
+ | for any needs you may have. Some filesystems are geared towards | ||
+ | particular media. For example, the iso9660 filesystem is used almost | ||
+ | exclusively for CD and DVD media. | ||
==== ext2 ==== | ==== ext2 ==== | ||
- | ext2 is the oldest filesystem included in Slackware Linux for storing data on hard disks. Compared to other filesystems, | + | ext2 is the oldest filesystem included in Slackware Linux for storing |
+ | data on hard disks. Compared to other filesystems, | ||
+ | It is faster than most others for reading and writing data, but does | ||
+ | not include any journaling capability. This means that after a hard | ||
+ | crash, the filesystem must be exhaustively checked to discover and | ||
+ | (hopefully) fix any errors. | ||
==== ext3 ==== | ==== ext3 ==== | ||
- | ext3 is the younger cousin of ext2. It was designed to replace ext2 in most situations and shares much the same code-base, but adds journaling support. In fact, ext3 and ext2 are so much alike that it is possible to convert one to the other on the fly without lose of data. ext3 enjoys a lot of popularity for these reasons. There are many tools available for recovering data from this filesystem in the event of catastrophic hardware failure as well. ext3 is a good general purpose filesystem with journaling support, but fails to perform as well as other journaling filesystems in specific cases. One pitfall to ext3 is that the filesystem must still go through this exhaustive check every so often. This is done when the filesystem is mounted, usually when the computer is booted, and causes an annoying delay. | + | ext3 is the younger cousin of ext2. It was designed to replace ext2 in |
+ | most situations and shares much the same code-base, but adds journaling | ||
+ | support. In fact, ext3 and ext2 are so much alike that it is possible | ||
+ | to convert one to the other on the fly without lose of data. ext3 | ||
+ | enjoys a lot of popularity for these reasons. There are many tools | ||
+ | available for recovering data from this filesystem in the event of | ||
+ | catastrophic hardware failure as well. ext3 is a good general purpose | ||
+ | filesystem with journaling support, but fails to perform as well as | ||
+ | other journaling filesystems in specific cases. One pitfall to ext3 is | ||
+ | that the filesystem must still go through this exhaustive check every | ||
+ | so often. This is done when the filesystem is mounted, usually when the | ||
+ | computer is booted, and causes an annoying delay. | ||
==== ext4 ==== | ==== ext4 ==== | ||
- | ext4 is the latest in the ext series of filesystems. It was designed to build upon ext3 with new ideas on what filesystems should do. While Slackware supports ext4, you should remember that this filesystem is still very new (particularly in file system terms) and is under heavy development. If you require stability over performance, | + | ext4 is the latest in the ext series of filesystems. It was designed to |
+ | build upon ext3 with new ideas on what filesystems should do. While | ||
+ | Slackware supports ext4, you should remember that this filesystem is | ||
+ | still very new (particularly in file system terms) and is under heavy | ||
+ | development. If you require stability over performance, | ||
+ | use a different filesystem such as ext3. With that said, ext4 does | ||
+ | boast some major improvements over ext3 in the performance arena, but | ||
+ | many people don't yet trust it for stable use. | ||
==== reiserfs ==== | ==== reiserfs ==== | ||
- | reiserfs is one of the oldest journaling filesystems for the Linux kernel and has been supported by Slackware for many years. It is a very fast filesystem particularly well suited for storing, retrieving, and writing lots of small files. Unfortunately there are few tools for recovering data should you experience a drive failure, and reiserfs partitions experience corruption more often than ext3. | + | reiserfs is one of the oldest journaling filesystems for the Linux |
+ | kernel and has been supported by Slackware for many years. It is a very | ||
+ | fast filesystem particularly well suited for storing, retrieving, and | ||
+ | writing lots of small files. Unfortunately there are few tools for | ||
+ | recovering data should you experience a drive failure, and reiserfs | ||
+ | partitions experience corruption more often than ext3. | ||
==== XFS ==== | ==== XFS ==== | ||
- | XFS was contributed to the Linux kernel by SGI and is one of the best filesystems for working with large volumes and large files. XFS uses more RAM than other filesystems, | + | XFS was contributed to the Linux kernel by SGI and is one of the best |
+ | filesystems for working with large volumes and large files. XFS uses | ||
+ | more RAM than other filesystems, | ||
+ | files its performance there is well worth the penalty in memory usage. | ||
+ | XFS is not particularly ill-suited for desktop or laptop use, but | ||
+ | really shines on a server that handles medium to large size files all | ||
+ | day long. Like ext3, XFS is a fully journaled filesystem. | ||
==== JFS ==== | ==== JFS ==== | ||
- | JFS was contributed to the Linux kernel by IBM and is well known for its responsiveness even under extreme conditions. It can span colossal volumes making it particularly well-suited for Network Attached Storage (NAS) devices. JFS's long history and thorough testing make it one of the most reliable journaling filesystems available for Linux. | + | JFS was contributed to the Linux kernel by IBM and is well known for |
+ | its responsiveness even under extreme conditions. It can span colossal | ||
+ | volumes making it particularly well-suited for Network Attached Storage | ||
+ | (NAS) devices. JFS's long history and thorough testing make it one of | ||
+ | the most reliable journaling filesystems available for Linux. | ||
==== iso9660 ==== | ==== iso9660 ==== | ||
- | iso9660 is a filesystem specifically designed for optical media such as CDs and DVDs. Since optical disks are read-only media, the linux kernel does not even include write support for this filesystem. In order to create an iso9660 filesystem, you must use user-land tools like mkisofs(8) or growisofs(8). | + | iso9660 is a filesystem specifically designed for optical media such as |
+ | CDs and DVDs. Since optical disks are read-only media, the linux kernel | ||
+ | does not even include write support for this filesystem. In order to | ||
+ | create an iso9660 filesystem, you must use user-land tools like | ||
+ | **//mkisofs//**(8) or | ||
+ | **//growisofs//**(8). | ||
==== vfat ==== | ==== vfat ==== | ||
- | Sometimes you may need to share data between Windows and Linux computers, but can't transfer the files over a network. Instead you require a shared hard drive partition or a USB flash drive. The humble vfat filesystem is the best choice here since it is supported by the largest variety of operating systems. Unfortuantely, | + | Sometimes you may need to share data between Windows and Linux |
+ | computers, but can't transfer the files over a network. Instead you | ||
+ | require a shared hard drive partition or a USB flash drive. The humble | ||
+ | vfat filesystem is the best choice here since it is supported by the | ||
+ | largest variety of operating systems. Unfortuantely, | ||
+ | designed filesystem, it does not store permissions in the same way as | ||
+ | traditional Linux filesystems. This means that special options must be | ||
+ | used to allow multiple users to access data on this filesystem. | ||
==== swap ==== | ==== swap ==== | ||
- | Unlike other filesystems which hold files and directories, | + | Unlike other filesystems which hold files and directories, |
+ | partitions hold virtual memory. This is very useful as it prevents the | ||
+ | system from crashing should all your RAM be consumed. Instead, the | ||
+ | kernel copies portions of the RAM into swap and frees them up for other | ||
+ | applications to use. Think of it as adding virtual memory to your | ||
+ | computer, very slow virtual memory. swap is typically a fail-safe and | ||
+ | shouldn' | ||
+ | if you find yourself using lots of swap. | ||
===== Using mount ===== | ===== Using mount ===== | ||
- | Now that we've learned what (some of) the different | + | Unlike other filesystems |
- | + | partitions hold virtual memory. This is very useful as it prevents | |
- | < | + | system from crashing should all your RAM be consumed. Instead, |
- | darkstar:~# mount -t ext3 /dev/hda3 /mnt/hd -o ro | + | kernel copies portions of the RAM into swap and frees them up for other |
- | </ | + | applications |
- | + | computer, very slow virtual memory. swap is typically a fail-safe and | |
- | Let's disect this. We have an ext3 filesystem located on the third partition of the first IDE device, and we've decided to mount its contents on the directory /// | + | shouldn't be relied upon for continual |
+ | if you find yourself using lots of swap. | ||
**Table 11.2. Common mount options** | **Table 11.2. Common mount options** | ||
Line 91: | Line 155: | ||
|defaults |sane defaults for most filesystems| | |defaults |sane defaults for most filesystems| | ||
- | If this is your first Linux installation, | + | If this is your first Linux installation, |
+ | typically need to be concerned about are //ro// and | ||
+ | //rw//. The exception to this rule comes when you are dealing | ||
+ | with filesystems that don't handle traditional Linux permissions such | ||
+ | as vfat or NTFS. In those cases you'll need to use the //uid// | ||
+ | or //gid// options to allow non-root users access to these | ||
+ | filesystems. | ||
< | < | ||
Line 97: | Line 168: | ||
</ | </ | ||
- | But Alan, that's appalling! I don't want to have to tell mount what filesystem or options to use everytime I load a CD. It should be easier than that. Well thankfully, it is. The ///etc/fstab// file contains all this information for filesystems that the installer sets up for you, and you can make additions to it as well. //fstab(5)// looks like a simple table containing the device to mount along with its filesystem type and optional arguments. Let's take a look. | + | |
+ | But Alan, that's appalling! I don't want to have to tell mount what | ||
+ | filesystem or options to use everytime I load a CD. It should be easier | ||
+ | than that. Well thankfully, it is. The '' | ||
+ | file contains all this information for filesystems that the installer | ||
+ | sets up for you, and you can make additions to it as well. | ||
+ | '' | ||
+ | device to mount along with its filesystem type and optional arguments. | ||
+ | Let's take a look. | ||
< | < | ||
Line 110: | Line 190: | ||
</ | </ | ||
- | If you have an entry in fstab for your filesystem, you need only tell mount the device node or the mount location. | + | |
+ | If you have an entry in '' | ||
+ | need only tell mount the device node or the mount location. | ||
< | < | ||
Line 117: | Line 200: | ||
</ | </ | ||
- | One final use for mount is to tell you what filesystems are currently mounted and with what options. Simply run mount without any arguments to display these. | ||
+ | One final use for | ||
+ | **// | ||
+ | is to tell you what filesystems are currently mounted and with what | ||
+ | options. Simply run | ||
+ | **// | ||
+ | without any arguments to display these. | ||
===== Network Filesystems ===== | ===== Network Filesystems ===== | ||
- | In addition to local filesystems, | + | In addition to local filesystems, |
+ | filesystems as both client and server. This allows you to share data | ||
+ | between multiple computers transparently. We'll discuss the two most | ||
+ | common: NFS and SMB. | ||
==== NFS ==== | ==== NFS ==== | ||
- | NFS is the Network File System for Linux as well as several other common operating systems. It has modest performance but supports the full range of permissions for Slackware. In order to use NFS as either a client or a server, you must run the remote procedure call daemon. This is easily accomplished by setting the /// | + | NFS is the Network File System for Linux as well as several other common |
+ | operating systems. It has modest performance but supports the full range of | ||
+ | permissions for Slackware. In order to use NFS as either a client or a | ||
+ | server, you must run the remote procedure call daemon. This is easily | ||
+ | accomplished by setting the '' | ||
+ | executable and telling it to start. Once it has been set executable, it | ||
+ | will run automatically every time you boot into Slackware. | ||
< | < | ||
Line 132: | Line 229: | ||
</ | </ | ||
- | Mounting an NFS share is little different than mounting a local filesystem. Rather than specifying a local device, you must tell mount the domain name or IP address of the NFS server and the directory to mount with a colon between them. | + | |
+ | Mounting an NFS share is little different than mounting a local filesystem. | ||
+ | Rather than specifying a local device, you must tell mount the domain name | ||
+ | or IP address of the NFS server and the directory to mount with a colon | ||
+ | between them. | ||
< | < | ||
Line 138: | Line 240: | ||
</ | </ | ||
- | Running an NFS server is a little bit different. First, you must configure each directory to be exported in the /// | + | |
+ | Running an NFS server is a little bit different. First, you must configure | ||
+ | each directory to be exported in the '' | ||
+ | file. '' | ||
+ | directories will be shared, who they will be shared with, and what special | ||
+ | permissions to grant or deny. | ||
< | < | ||
Line 148: | Line 256: | ||
</ | </ | ||
- | The first column in exports is a list of the files to be exported via NFS. The second column is a list of what systems may access the export along with special permissions. You can specify hosts via domain name, IP address, or netblock address (as I have here). Special permissions are always a parenthetical list. For a complete list, you'll need to read the man page. For now, the only special option that matters is [no_root_squash]. Usually the root user on an NFS client cannot read or write an exported share. Instead, the root user is " | ||
- | You' | + | The first column in |
+ | '' | ||
+ | is a list of the files to be exported via NFS. The second column is a list | ||
+ | of what systems may access the export along with special permissions. | ||
+ | can specify hosts via domain name, IP address, or netblock address (as I | ||
+ | have here). Special permissions are always a parenthetical list. For a | ||
+ | complete list, you'll need to read the man page. For now, the only special | ||
+ | option that matters is //no_root_squash//. Usually the root user on | ||
+ | an NFS client cannot read or write an exported share. Instead, the root | ||
+ | user is //" | ||
+ | // | ||
+ | |||
+ | You'll also need to run the NFS daemon. Starting and stopping NFS server | ||
+ | support is done with the ''/ | ||
+ | Set it executable and run it just like we did for | ||
+ | '' | ||
==== SMB ==== | ==== SMB ==== | ||
- | SMB is the Windows network file-sharing protocol. Connecting to SMB shares (commonly called samba shares) is fairly straight forward. Unfortuantely, | + | SMB is the Windows network file-sharing protocol. Connecting to SMB shares |
+ | (commonly called samba shares) is fairly straight forward. Unfortuantely, | ||
+ | SMB isn't as strongly supported as NFS. Still, it offers higher performance | ||
+ | and connectivity with Windows computers. For these reasons, SMB is the most | ||
+ | common network file-sharing protocol deployed on local networks. Exporting | ||
+ | SMB shares from Slackware is done through the samba daemon and configured | ||
+ | in '' | ||
+ | service is beyond the scope of this book. Check online for additional | ||
+ | documentation, | ||
+ | |||
+ | |||
+ | Thankfully mounting an SMB share is easy and works almost exactly like | ||
+ | mounting an NFS share. You must tell mount where to find the server and | ||
+ | what share you wish to access in exactly the same way. Additionally, | ||
+ | must specify a username and password. | ||
- | Thankfully mounting an SMB share is easy and works almost exactly like mounting an NFS share. You must tell mount where to find the server and what share you wish to access in exactly the same way. Additionally, | ||
< | < | ||
Line 162: | Line 297: | ||
</ | </ | ||
- | You may be wondering why the filesystem type is cifs instead of smbfs. In older versions of the Linux kernel, smbfs was used. This has been deprecated in favor of the better performing and more secure general purpose cifs driver. | ||
- | All SMB shares require the [username] and [password] arguments. This can create a security problem if you wish to place your samba share in fstab. You may avoid this problem by using the [credentials] argument. | + | You may be wondering why the filesystem type is cifs instead of smbfs. In |
+ | older versions of the Linux kernel, smbfs was used. This has been | ||
+ | deprecated in favor of the better performing and more secure general | ||
+ | purpose cifs driver. | ||
+ | |||
+ | |||
+ | All SMB shares require the //username// and //password// | ||
+ | arguments. This can create a security problem if you wish to place your | ||
+ | samba share in fstab. You may avoid this problem by using the | ||
+ | //credentials// argument. | ||
+ | which contains the username and password information. As long as this file | ||
+ | is safely guarded and readable only by root, the likelyhood that your | ||
+ | authentication credentials will be compromised is lessened. | ||
< | < | ||
Line 171: | Line 318: | ||
darkstar:~# mount -t cifs // | darkstar:~# mount -t cifs // | ||
</ | </ | ||
+ | |||
+ | ====== Chapter Navigation ====== | ||
+ | |||
+ | **Previous Chapter: [[slackbook: | ||
+ | |||
+ | **Next Chapter: [[slackbook: | ||
====== Sources ====== | ====== Sources ====== | ||
- | * Original source: [[http:// | + | <!-- If you copy information from another source, then specify that source --> |
+ | * Original source: [[http:// | ||
+ | <!-- Authors are allowed to give credit to themselves! --> | ||
+ | * Originally written by Alan Hicks, Chris Lumens, David Cantrell, Logan Johnson | ||
+ | <!-- * Contrbutions by [[wiki: | ||
<!-- Please do not modify anything below, except adding new tags.--> | <!-- Please do not modify anything below, except adding new tags.--> | ||
- | {{tag> | + | <!-- You must also remove the tag-word " |
+ | {{tag> |