You are on page 1of 14

Welcome To Filesystem

Troubleshooting
Cannot CD Into a Directory

• Directory does Not Exist


• Absolute vs. Relative Paths
• Permissions
• -rwxrwxrwx

t r w x r w x r w x
- -u- - |- g- - | - o- -
• File Type
• Parent Directory Permissions
• Hidden Directories

By: Imran Afzal


Cannot Open a File Or Run a Script

• File does Not Exist


• Absolute vs. Relative Paths
• Permissions
• -rwxrwxrwx
t r w x r w x r w x
- -u- - |- g- - | - o- -
• File Type
• Hidden Directories

By: Imran Afzal


Having Trouble Finding Files and Directories

• Run the right command (find)


• Command syntax
• Additional commands for updates (locate)
• File/directory exist

By: Imran Afzal


Cannot Create Links

• What is a link?
• Type of links
• Hard link and symbolic link
• Command and syntax (source first and then target)
• Complete paths (example: ln –s /home/iafzal/seinfeld/george /tmp/gc)

• Permissions
• Source or target file/dir missing or does not exist.

By: Imran Afzal


Cannot Write to a File

• File does Not Exist


• Absolute vs. Relative Paths
• File Type
• Permissions and ownership
t r w x r w x r w x
- -u- - |- g- - | - o- -
• Parent Directory Permissions
• Hidden File
• File is already open by another user
• Run command ‘getfacl’ (get file access control lists).

By: Imran Afzal


Cannot Delete, Copy, Rename or Move a File

• File does Not Exist


• Absolute vs. Relative Paths
• File Type
• Permissions
t r w x r w x r w x
- -u- - |- g- - | - o- -
• Parent Directory Permissions
• Hidden File
• Command syntax (Source and then target).

By: Imran Afzal


Cannot Change File Permissions / Ownership

• File does Not Exist


• Absolute vs. Relative Paths
• File ownership (user and group)
• Permissions
t r w x r w x r w x
- -u- - |- g- - | - o- -
• Parent Directory Permissions
• Hidden File
• Command syntax (User and then file) – e.g. chown/chgrp user/group filename
• Command with recursive option (-R)
• Only root can change the file ownership.
By: Imran Afzal
Cannot View Other Users’ Files

• File does Not Exist


• Absolute vs. Relative Paths
• File ownership (user and group)
• Permissions
t r w x r w x r w x
- -u- - |- g- - | - o- -
• Parent Directory Permissions
• Hidden File
• Command syntax
• Only root can view any files

By: Imran Afzal


Cannot Change Password

• File does Not Exist


• Absolute vs. Relative Paths
• File ownership (user and group)
• Permissions
t r w x r w x r w x
- -u- - |- g- - | - o- -
• Parent Directory Permissions
• Hidden File
• Command syntax
• Only root can view any files

By: Imran Afzal


Disk Space Full or Add More Disk Space

• What = df
• Actions
• Find out what is causing the issue (du)
• Free up disk space by deleting old or big files
• Compress the old files (tar -czvf archive.tar.gz file)
• Move files to another partition or another server
• Check harddisk status
• badblocks -v /dev/DISK or /dev/sda
• iostat
• Create a link to another filesystem or directory
• Add additional disk and extend using LVM

• Next lectures…
• Add Disk and Create Standard Partition
• Add Disk and Create LVM Partition
• Extend Disk with LVM.
By: Imran Afzal
How to Delete Old Files

• Delete using rm command


• Find files and then delete old files

Command Syntax
• find /path/to/files/ -type f -name '*.jpg' -mtime +30 -exec rm {} \;

Explanation
• First part is the path where your files are located.
• Second part -type is the file type f stands for files
• Third part -name is for using the actual file names
• Fourth part -mtime gets how many days the files older then will be listed. +30 is
for files older then 30 days.
• Fifth part -exec executes a command. In this case rm is the command, {} gets the
filelist and \; closes the command

By: Imran Afzal


Filesystem is Corrupted

• Filesystem?
• Types of filesystem
• ext3, ext4, xfs, NTFS etc.
• Filesystem Layout and partitions
• /var, /etc, /root, /home etc.
• Checking filesystem
• df, fdisk –l

• Troubleshooting Steps:
• Check /var/log/messages or /var/log/syslog
• Run fsck on the block device (/dev/sda) NOT on mount point
• Unmount filesystem and run fsck

By: Imran Afzal


/etc/fstab Corruption
• What is /etc/fstab?
• OS filesystem table
• Understanding /etc/fstab
• Device, mount point, filesystem type, Options, backup, filesystem check order
• Checking filesystem
• df
• Checking or verifying /etc/fstab
• cat, more, vi, vim etc.

• Issue – System is NOT booting


• Incorrect entry in /etc/fstab
• Accidental deletion of /etc/fstab

• Troubleshooting Steps:
• Boot in rescue mode by mounting CD / CD ISO image
• Chose option 1 to mount root filesystem
• Fix the /etc/fstab file
• For deleted file = run blkid
By: Imran Afzal

You might also like