0% found this document useful (0 votes)
79 views42 pages

Chapter Three

The df command displays disk space usage information for all mounted file systems. The du command shows disk usage of files and directories. The ncdu tool provides a visual interface to see disk usage by directory in a tree view. These commands help administrators monitor disk space usage and identify space-hogging files and directories.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views42 pages

Chapter Three

The df command displays disk space usage information for all mounted file systems. The du command shows disk usage of files and directories. The ncdu tool provides a visual interface to see disk usage by directory in a tree view. These commands help administrators monitor disk space usage and identify space-hogging files and directories.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 42

Controlling Access to files (ACLs)

❖ Are an additional mechanism for controlling access to files and folders.


❖ ACLs are used in conjunction with file and folder permissions.
➢ key commands used to manage file and folder permissions and ACLs:
● chmod: Used to change file and folder permissions.
● chown: Used to change the owner of a file or folder.
● chgrp: Used to change the group of a file or folder.
● setfacl: Used to set ACLs on files and folders.
● getfacl: Used to view ACLs on files and folders.
…Cont’d
General Syntax:

To give full permission(read, write and execute) for user kemal to file
a.txt

For further example, you can get the writing syntax of ACLs
Setfacl --help Quiz(3%)
1. Write linux command to give read only permission for user john to
file1.txt using ACLs
…Cont’d

To view ACLs
Managing Disk Quotas

❏ disk quotas are used to limit the amount of disk space that users and groups
can use on a file system.
❏ This is an important feature for system administrators who need to manage
disk space usage and prevent users from filling up the file system.
A. Enabling disk quotas: Disk quotas must be enabled on a file system before they can
be used. This is typically done by editing the file system /etc/fstab file and adding the
usrquota and/or grpquota options to the mount options for the file system. For
example:

This line enables user and group quotas on the /home file system
…Cont’d
B. Setting up quotas: Once disk quotas are enabled, quotas must be set up for individual users or groups.
This is done using the edquota command. The syntax of the command is as follows:

OR
…Cont’d
C. Monitoring quotas: Once quotas are set up, they can be monitored using the quota command. The syntax
of the command is as follows:

OR

This command displays the current disk usage and quota limits for the specified
user or group.
…Cont’d
D. Adjusting quotas: Quotas can be adjusted using the edquota command. The administrator can edit the
quota configuration file for a user or group to increase or decrease their quota limits.

Overall, managing disk quotas is an important task in Linux and other Unix-like
systems that system administrators need to perform to manage disk space usage and
prevent users from filling up the file system. By enabling, setting up, monitoring, and
adjusting quotas, system administrators can effectively manage disk usage and ensure
that disk space is available for critical system processes and applications.
Chapter Three
File System and Management of Data storage
File System

What is a File System?


❑ A file system is a way of organizing and managing files on a storage
device.
❑ Such as: a hard disk drive or solid-state drive
❑ It provides a logical structure for organizing files and directories.
❑ allows users to access and manage those files.
Types of File Systems

● FAT: The File Allocation Table (FAT)


○ widely-used file system that was originally developed for floppy disks and other small storage devices.
○ . It is still used today on some USB drives and other portable storage devices.

● NTFS: The New Technology File System (NTFS)


○ more advanced file system developed by Microsoft for use on Windows computers.
○ It supports larger file sizes, more efficient use of disk space, and better security features than FAT.

● EXT: The Extended File System (EXT)


○ file system used on Linux and other Unix-like operating systems
○ designed for use with the Linux kernel and provides features such as journaling and support for file
permissions.
…Cont’d

● APFS: The Apple File System (APFS)


○ a modern file system developed by Apple for use on its macOS, iOS, and other
operating systems.
○ It is designed to be fast, secure, and efficient, and provides features such as
encryption and snapshotting.
File System Administration Tasks

● Partitioning: This involves dividing a hard drive or other storage device into multiple
partitions, each with its own file system.
● Formatting: Once a partition has been created, it needs to be formatted with a file system.
● Mounting: When a file system is mounted, it is made available for use by the operating
system and applications.
● Managing file permissions: File system administrators need to manage permissions for
files and directories, determining who has access to them and what actions they can
perform.
…Cont’d

• Monitoring disk usage: It's important to keep track of how much disk
space is being used and ensure that there is enough free space available for
new files and applications.
• Backing up and restoring data: Backing up important files and data is
crucial for preventing data loss in the event of a system failure or other
disaster. File system administrators need to develop and implement backup
and recovery strategies to ensure data can be restored if necessary.
Partitioning disk with fdisk and parted

● fdisk is a command-line utility for partitioning disks on Linux systems. Here's how you can use it to partition a
disk:
○ Step1 Open terminal

○ Step2 write fdisk /dev/sdX , where X is the driver letter


○ Step3 fdisk will display a warning message about potentially destructive actions. Press "n" to create a new
partition.
○ Step4 Follow the prompts to specify the partition type, starting and ending sectors, and other details about the
new partition.
○ Step5 Repeat the process to create additional partitions as needed.
○ Step6 Once you have created all of the partitions you need, press "w" to write the changes to disk and exit fdisk.
..Cont’d

sda has 3
partitions:
sda1,sda2,sda5

sdb has no
partitions
create partitions in disk sdb

to ceate new
partition
…Cont’d

now, primary partition


sdb1 created from disk
sdb
…Cont’d

● parted is another command-line utility for partitioning disks on Linux systems. Here's how you can use it to
partition a disk:

1. Open a terminal window and log in as the root user or use the sudo command to run parted with root privileges.

2. Type "parted /dev/sdX" to start parted, where "X" is the letter corresponding to the disk you want to partition. For

example, if you want to partition the first hard disk in the system, you would use "parted /dev/sda".\
3. Type mkpart <partition type> <file type> <starting sector> <ending sector>

mkpart primary ext4 0% 20GB


3. Repeat the process to create additional partitions as needed.

4. Once you have created all of the partitions you need, use the "quit" command to exit parted.
…Cont’d

Newly created
partition
..Cont’d

To delete partition
Open Terminal
sudo fdisk /dev/sdx where x is partition name eg. /dev/sda
Enter d to delete partition
Enter partition number eg. if partition is at /dev/sda1 Enter 1
Enter w to write on the disk
quit
mkfs.ext4 /dev/sda1
…Cont’d

● Both fdisk and parted are powerful tools for partitioning disks, and can
be used to create complex partition layouts with multiple partitions of
different types and sizes. It's important to be careful when using these
tools, as errors or mistakes can result in data loss or other problems. Be
sure to backup important data before making any changes to disk
partitions.
Creating a file system

● To create a new file system on a disk partition, you can use the
mkfs command followed by the type of file system you want to
create (e.g., ext4, xfs, btrfs, etc.) and the name of the partition you
want to format.

This command will format the first partition on the first hard disk in
the system with the ext4 file system.
Mounting a file system

● To mount a file system, you first need to create a mount point (i.e.,
a directory where the file system will be accessible). You can use
the mkdir command to create a new directory for this purpose.
Maintaining a file system

● To maintain a file system, there are several tools and commands


available on Linux systems.
• df: displays information about disk usage and available space on file systems
• du: displays information about disk usage of files and directories
• fsck: checks and repairs file system errors
• tune2fs: allows you to tune various parameters of an ext2, ext3, or ext4 file
system
• xfs_repair: checks and repairs XFS file systems
…Cont’d

Check disk usage


on /home directory

Display disk free space with


human readable format
Swap

● Swap is an area on a hard drive that is used as a virtual memory


extension when the physical memory (RAM) is full. Linux systems typically
use a dedicated swap partition or a swap file to provide this functionality.
● Creating a swap partition
1. Determine the size of the swap partition you need
2. Use a partitioning tool like fdisk or parted to create a new partition on your hard drive. Make sure to set
the partition type to "Linux swap" (type code 82).
3. Format the new partition with the mkswap command.
…Cont’d

To make the swap partition persistent across reboots, add an entry for it in the
/etc/fstab file.
Determining disk usage with du and df

● du: used to estimate the space used by file and directories.


● df: used to display the amount of disk space available on file
systems.

For further du and df usage, enter du –help and df --help


Configuring Disk Quota

● Disk quotas are a feature of the Linux file system that allows
system administrators to limit the amount of disk space a user or
group can use.
● To configure disk quota,
go to /et/fstab and adding user and group quota

Step 1: Enable Quota Support


…Cont’d

mount -o remount /home


sudo apt-get install quota
/home 0 0 1000 2000 0 0 //edit the /etc/quotatab
sudo edquota cs //where cs is username
sudo repquota /home to monitor disk usage quota

In the fstab file, the number 2 specifies the order in which file systems are checked
for errors at boot time.
Logical volume management and RAID

❏ Logical Volume Management (LVM) and Redundant Array of


Independent Disks (RAID) are two technologies that can help manage
and protect data on Linux systems.
❏ Logical Volume Management (LVM)
❏ LVM is a technology that allows you to create logical volumes from multiple physical
volumes (such as hard drives or partitions), and manage them as a single, flexible storage
pool.
❏ With LVM, you can easily resize volumes, add or remove physical storage, and take
snapshots of volumes for backups or testing purposes.
In this diagram, we have three
physical disks at the bottom, disk
1 has three partitions (sky, green and
red colors), disk 2 has only one
partitions (red ones) and disk 3 has
two partitions (red and green).
There are two logical volume group
LV1 & LV2.
/boot directory found in disk 1
/ directory found in LV1 and LV1
can access two partitions from
Disk1 and one partition from Disk 3
Redundant Array of Independent Disks (RAID)

Stands for Redundant Array of Independent Disks.


It’s a technology that enables greater levels of performance, reliability and/or

large volumes when dealing with data.


How?? By concurrent use of two or more ‘hard disk drives’.
How Exactly?? Mirroring, Stripping (of data) and Error correction techniques

combined with multiple disk arrays give you the reliability and performance.
RAID 0

It splits data among two or more disks.

Provides good performance.

Lack of data redundancy means there is no fail over support


with this configuration.

Used in read only NFS systems and gaming systems


RAID 0

In the diagram to the right, the odd blocks are


written to disk 0 and the even blocks to disk
1 such that A1, A2, A3, A4, … would be the
order of blocks read if read sequentially from
the beginning.
RAID 1
RAID1 is ‘data mirroring’.

Two copies of the data are held on two physical disks, and the data is
always identical.

Twice as many disks are required to store the same data when compared
to RAID 0.

Array continues to operate so long as at least one drive is functioning.


RAID 1
 This type of RAID uses mirroring to copy data
across two or more hard drives, providing
redundancy in case of a drive failure.

 However, it requires at least two drives, and you


lose half of your available storage capacity due
to the mirroring.
RAID 5
 RAID 5 is an ideal combination of good performance, good fault
tolerance and high capacity and storage efficiency.

 An arrangement of parity and CRC to help rebuilding drive data


in case of disk failures.

 “Distributed Parity” is the key word here.


In this diagram parity code is
distributed across each disk.
RAID 10

 Combines RAID 1 and RAID 0.

 Which means having the pleasure of


both - good performance and good
failover handling.

 Also called ‘Nested RAID’.


Implementations
Software based RAID:
• Software implementations are provided by many Operating
Systems.
• A software layer sits above the disk device drivers and provides an
abstraction layer between the logical drives(RAIDs) and physical
drives.
• Server's processor is used to run the RAID software.
• Used for simpler configurations like RAID0 and RAID1.
Hardware based RAID:
• A hardware implementation of
RAID requires at least a special-
purpose RAID controller.
• On a desktop system this may be
built into the motherboard.
• Processor is not used for RAID
calculations as a separate
controller present.
A PCI-bus-based, IDE/ATA hard disk
RAID
controller, supporting levels 0, 1, and 01.

You might also like