Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Linux Command Line and Shell Scripting Bible - Third Edition

You're reading from  Linux Command Line and Shell Scripting Bible - Third Edition

Product type Book
Published in Jan 2015
Publisher Wiley
ISBN-13 9781118983843
Pages 816 pages
Edition 3rd Edition
Languages
Authors (2):
Richard Blum Richard Blum
Profile icon Richard Blum
Christine Bresnahan Christine Bresnahan
Profile icon Christine Bresnahan
View More author details

Table of Contents (34) Chapters

1. Introduction 2. Part I: The Linux Command Line
3. Chapter 1: Starting with Linux Shells 4. Chapter 2: Getting to the Shell 5. Chapter 3: Basic bash Shell Commands 6. Chapter 4: More bash Shell Commands 7. Chapter 5: Understanding the Shell 8. Chapter 6: Using Linux Environment Variables 9. Chapter 7: Understanding Linux File Permissions 10. Chapter 8: Managing Filesystems 11. Chapter 9: Installing Software 12. Chapter 10: Working with Editors 13. Part II: Shell Scripting Basics
14. Chapter 11: Basic Script Building 15. Chapter 12: Using Structured Commands 16. Chapter 13: More Structured Commands 17. Chapter 14: Handling User Input 18. Chapter 15: Presenting Data 19. Chapter 16: Script Control 20. Part III: Advanced Shell Scripting
21. Chapter 17: Creating Functions 22. Chapter 18: Writing Scripts for Graphical Desktops 23. Chapter 19: Introducing sed and gawk 24. Chapter 20: Regular Expressions 25. Chapter 21: Advanced sed 26. Chapter 22: Advanced gawk 27. Chapter 23: Working with Alternative Shells 28. Part IV: Creating Practical Scripts
29. Chapter 24: Writing Simple Script Utilities 30. Chapter 25: Producing Scripts for Database, Web, and E-Mail 31. Chapter 26: Creating Fun Little Shell Scripts 32. End User License Agreement
Appendix A: Quick Guide to bash Commands 1. Appendix B: Quick Guide to sed and gawk

Chapter 8
Managing Filesystems

Exploring Linux Filesystems

Chapter 3 discussed how Linux uses a filesystem to store files and folders on a storage device. The filesystem provides a way for Linux to bridge the gap between the ones and zeroes stored in the hard drive and the files and folders you work with in your applications.

Linux supports several types of filesystems to manage files and folders. Each filesystem implements the virtual directory structure on storage devices using slightly different features. This section walks you through the strengths and weaknesses of the more common filesystems used in the Linux environment.

Understanding the basic Linux filesystems

The original Linux system used a simple filesystem that mimicked the functionality of the Unix filesystem. This section discusses the evolution of that filesystem.

Looking at the ext Filesystem

The original filesystem introduced with the Linux operating system is called the extended filesystem (or just ext for short). It provides a basic Unix-like...

Working with Filesystems

Linux provides a few different utilities that make it easier to work with filesystems from the command line. You can add new filesystems or change existing filesystems from the comfort of your own keyboard. This section walks you through the commands for interacting with filesystems from a command line environment.

Creating partitions

To start out, you need to create a partition on the storage device to contain the filesystem. The partition can be an entire disk or a subset of a disk that contains a portion of the virtual directory.

The fdisk utility is used to help you organize partitions on any storage device installed on the system. The fdisk command is an interactive program that allows you to enter commands to walk through the steps of partitioning a hard drive.

To start the fdisk command, you need to specify the device name of the storage device you want to partition and you need to have superuser privileges. When you don't have superuser privileges...

Managing Logical Volumes

If you create your filesystems using standard partitions on hard drives, trying to add additional space to an existing filesystem can be somewhat of a painful experience. You can only expand a partition to the extent of the available space on the same physical hard drive. If no more space is available on that hard drive, you're stuck having to get a larger hard drive and manually moving the existing filesystem to the new drive.

What would come in handy is a way to dynamically add more space to an existing filesystem by just adding a partition from another hard drive to the existing filesystem. The Linux Logical Volume Manager (LVM) software package allows you to do just that. It provides an easy way for you to manipulate disk space on a Linux system without having to rebuild entire filesystems.

Exploring logical volume management layout

The core of logical volume management is how it handles the physical hard drive partitions installed on the system. In...

Summary

Working with storage devices in Linux requires that you know a little bit about filesystems. Knowing how to create and work with filesystems from the command line can come in handy as you work on Linux systems. This chapter discussed how to handle filesystems from the Linux command line.

The Linux system is different from Windows in that it supports lots of different methods for storing files and folders. Each filesystem method has different features that make it ideal for different situations. Also, each filesystem method uses different commands for interacting with the storage device.

Before you can install a filesystem on a storage device, you must first prepare the device. The fdisk command is used to partition storage devices to get them ready for the filesystem. When you partition the storage device, you must define what type of filesystem will be used on it.

After you partition a storage device, you can use one of several different filesystems for the partition. Popular...

lock icon The rest of the chapter is locked
You have been reading a chapter from
Linux Command Line and Shell Scripting Bible - Third Edition
Published in: Jan 2015 Publisher: Wiley ISBN-13: 9781118983843
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}