RH033 Unit16 The Linux Filesystem In-Depth

Ojectives
Upon completion of this unit, you should be able to:
  • Describe how filesystem information is organized
  • Describe the function of dentries and inodes
  • Describe how cp, mv and rm work at the inode level
  • Create symbolic links and hard links
  • Access removable media
  • Create archives using tar and gzip
Partitions and Filesystems
1) Disk drives are divided into partitions
2) Partitions are formatted with filesystems, allowing users to store data
  • Default filesystems: ext3, the Third Extended Linux Filesystem
  • Other common filesystems:
    • ext2 and msdos (typically used for floppies)
    • iso9660 (typically used for CDs)
    • GFS and GFS2 (typically used for SANs)
Inodes
1) An inode table contains a list of all files in an ext2 or ext3 filesystem
2) An inode (index node) is an entry in the table, containing information of a file (the metadata), including:
  • file type, permissions, UID, GID
  • the link count (count of path names pointing to this file)
  • the file’s size and various stamps
  • pointers to the file’s data blocks on disk
  • other data about the file
Directories
1) The computer’s reference for a file is the inode number
2) The human way to reference a file is by file name
3) A directory is a mapping between the human name for the file and the computer’s inode number
cp and inodes
The cp command:
  • Allocate a free inode number, placing a new entry in the inode table
  • Creates a dentry in the directory, associating a name with the inode number
  • Copies data into the new file
mv and inodes
1) If the destination of the mv command is on the same file system as the source, the mv command:
  • Creates a new directory entry with the new file name
  • Deletes the old directory entry with the old file name
2) Has no imact on the inode table (except for a time stamp) or the location of data on the disk: no data is moved!
3) If the destination is a different filesystem, mv acts as a copy and remove
rm and inodes
1) The rm command:
  • Decrements the link count, thus freeing the inode number to be reused
  • Places data blocks on the free list
  • Removes the directory entry
2) Date is not actually removed, but will be overwritten when the data blocks are used by another file
Hard Links
1) A hard link adds an additional pathname to reference a single file
  • One physical file on the filesystem
  • Each directory references the same inode number
  • Increments the link count
    • The rm command decrements the link count
    • File exists as long as at least one link remains
    • When the link account is zero, the file is removed
  • Cannot span drives or partitions
2) Syntax: ln filename [linkname]
Symbolic (or Soft) Links
1) A symbolic link points to another file
  • ls –l displays the link name and the referenced file
  • File type: l for symbolic link
  • The content of a symbolic link is the name of the file that is references
2) Syntax: ln –s filename linkname
The Seven Fundamental Filetypes
ls –l symbolFile Type
-regular file
d directory
lsymbolic link
bblock special file
ccharacter special file
pnamed pipe
ssocket
  
Checking Free Space
1) df – Reports disk space usage
  • Reports total kilobytes, kilobytes used, kilobytes free per file system
  • -h and –H display sizes in easier to read unit
2) du – Reports disk space usage
  • Reports kilobytes used per directory
  • Includes subtotals for each subdirectory (-s option only reports single directory summary)
  • Also takes –h and –H options
3) Applications –> System Tools –> Disk Usage Analyzer or baobab – Reports disk space usage graphically
Removable Media
1) Mounting means making a foreign filesystem look like part of the main tree
2) Before accessing, media must be mounted
3) Before removing, media must be unmouted
4) By default, non-root users may only mount certain devices (cd, dvd, floppy, usb, etc)
5) Mountpoints are usually under /media
Mounting CDs and DVDs
1) Automatically mounted in Gnome/KDE
2) Otherwise, must be manually mouted
  • CD/DVD Reader – mount /media/cdrom
  • CD/DVD Writer – mount /media/cdrecorder
3) eject command unmounts and ejects the disk
Mounting USB Media
1) Detected by the kernel as SCSI devices
  • /dev/sdaX or /dev/sdbX or similar
2) Automatically mounted in Gnome/KDE
  • Icon created in computer window
  • Mounted under /media/Device ID – Device ID is built into device by vendor
Mounting Floppy Disks
1) Must be manually mounted and unmounted
  • mount /media/floppy
  • umount /media/floppy
2) DOS floppies can be accessed with mtools
  • Mounts and unmounts device transparently
  • uses DOS naming conventions
    • mdir a:
    • mcopy /home/file.txt a:
Archiving Files and Compressing Archives
1) Archiving places many files into on target file
  • Easier to backup, store, and transfer
  • tar – standard Linux archiving command
2) Archives are commonly compressed
  • Algorithm applied that compressed file
  • Umcompressing retores the original file
  • tar natively supports compression using gzip and gunzip, or bzip2 and bunzip2
Creating, Listing, and Extracting File Archives
1) Action arguments (one is required)
  • -c create an archive
  • -t list an archive
  • -x extracts files from an archive
2) Typically requried:
  • -f archviename name of file archive
3) Optional arguments:
  • -z use gzip compression
  • -j use bzip2 compression
  • -v be verbose
Creating File Archives: Other Tools
1) zip and unzip
  • Supports pkzip-compatible archives
2) file-roller
  • Graphical, multi-format archiving tool
End of Unit16
1) Questions and Answers
2) Summary
  • Linux filesystem structure
  • Using removable media
  • Using unformatted floppies
  • Archiving and compression
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
filesystem-3.2-25.el7.x86_64是一个Linux操作系统下的文件系统工具包,适用于x86_64架构的计算机。该工具包的版本号为3.2-25,适用于运行CentOS 7操作系统的计算机。 文件系统是操作系统中用于管理和存储文件的一种机制,它负责对文件进行存储和组织,提供文件的访问和管理功能。文件系统可以将文件存储在磁盘上,并将其组织成目录和子目录的层次结构,使用户能够方便地访问和管理文件。 文件系统工具包是为了提供文件系统管理和操作的相关工具而设计的,可以进行文件系统的格式化、挂载、卸载等操作。它还提供了一些命令行工具,如ls用于列出文件和目录、cp用于复制文件、mv用于移动文件、rm用于删除文件等等。 对于Linux操作系统而言,文件系统的管理非常重要。它不仅关乎文件的存储和组织,还关系到系统的稳定性和性能。因此,安装和使用适合的文件系统工具包是保证系统正常运行的关键之一。 在CentOS 7操作系统中,filesystem-3.2-25.el7.x86_64是一个被广泛使用的文件系统工具包。通过安装该工具包,用户可以轻松地管理、操作和维护文件系统,确保文件的安全性和可靠性。 总结来说,filesystem-3.2-25.el7.x86_64是一个Linux操作系统中用于管理和维护文件系统的工具包,它具备丰富的功能和命令行工具,适用于CentOS 7操作系统。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值