Ping-t (subject 104) device, Linux file system, FSH

I'm taking the LinuC exam, so don't forget to just summarize the commentary here.

Swap area

The swap area is an area created on the HD to temporarily store information that has not been cured in physical memory (real memory).

The command to invalidate the swap area is → swap off Command to create swap area → mkswap mkfs → Create various file systems (wiring guy ← this story w) swap on → Turn on swap. fdisk → Used when creating a partition for swap (the one who creates partitions w)

fdisk w Save the changes in the partition table and exit q Exit without saving changes in the partition table m List of subcommands l List of partition types n Create partition p Partition table list display (used when checking t Change system ID

mkfs You can create an ext2 / ext3 / ext4 file system with the mke2fs command. By the way, ext2 / ext3 / ext4 is a file system where the number of inodes is limited. It is also possible to create a file system by specifying the file type with the option -t + file system type.

inode An inode is a Linux file system that stores file attributes (permissions and users). The dynamic inode function is a function that dynamically assigns an inode number when creating a file. There is no limit to the number of inodes, as inodes are dynamically assigned. For filesystems that do not have dynamic inode functionality, inodes are created when the filesystem is created and cannot be augmented. Therefore, if the number of files increases and there are no more available inodes, you will not be able to create new files even if there is free space on the disk.

Command that can check the usage status of inode → df -i

These guys have an inode function ・ XFS ・ JFS ・ ReiserFS

Hard link

A hard link is a link that directly references the file entity. (1) Since it indicates the substance of the same file, the inode number will be the same. (2) It cannot be created if the file system is different (since the inode number is managed for each file system, it is not possible to create a hard link to a different file system. ③ It is OK to produce multiple ④ You cannot create a hard link for a directory → To prevent the creation of a circular directory

Symbolic link

A symbolic link is like a shortcut in Windows, a link that points to the location of the original file. The information that the symbolic link has is only the path information "where is the original file (directory)".

↑ Create an ext3 file system by using the -j option!

Also, with the mkfs command, you can specify and create not only ext2 / ext3 / ext4 but also file systems such as reiserfs and xfs with the "-t" option.

※ etx2 has no journaling function! A journaling file system is a file system that has a journaling function. The journaling function is a function that records the update history in a journal (log). By using the information recorded in the journal, you can recover data in a short time in the event of a failure.

As a flow to actually use swap,

  1. Prepare a partition (or file) for swap
  2. Create swap space with mkswap command
  3. Enable swap space with the swapon command
  4. Disable swap space with the swapoff command (if no longer needed)

Create swap area → mkswap Enable swap area → swapon

partition

Partitions have basics and extensions. (For MBR) Basically, you can only make up to four. Therefore, it is necessary to create a logical partition as an extended partition that becomes larger than that. You need a command called fdisk to operate this With GPT, you can make 128 basics. But up to 8 MBRs.

To use a new hard disk on a Linux system

  1. Partition (create primary partition, extended partition, logical partition)
  2. Format each partition and create a file system
  3. Mount the created file system

・ / Dev / sda1 1st partition ・ / Dev / sda2 2nd partition ・ / Dev / sda3 3rd partition ・ / Dev / sda4 4th partition

MBR → Maximum hard disk 2TB, mobile system y firmware BIOS, 4 basic partitions GPT → 8ZB, UEFI, 128 operated with gdisk command

Partition operation command that supports MBR format and GPT format partition table is parted

parted -l Show partition table for all devices with device file name.

du command

A command that allows you to check the space occupied by a file or directory The options are: -a Display files other than directories -h Display in easy-to-understand units -c also displays the total capacity -s Gives the total capacity of the specified file or directory -k Display in KB -m Display in MB

dumpe2fs This is the command to display various information of the ext2 / ext3 / ext4 file system. dumpe2fs

df Command to display the free space of the device

ps A command to display the running processes

fsck Commands that can check the file system and fix problems The e2fsck command can also check the ext2 / ext3 / ext4 file system. 【option】 -a Automatically fix problems -N Show what to do without actually doing it -A Runs for all filesystems

[E2fsck options] -y Automatically yes for all inquiries -n Automatically no for all inquiries -p Automatically resolve all issues

tune2fs To change from ext2 to ext3, use the tune2fs command. [This is an option] -j Convert from ext2 to ext3.

About automatic mounting

By performing mount -a at system startup, all file systems for which the mount option "auto" is set in the "/ etc / fstab" file will be mounted. That is, file systems that are set to "auto" will be mounted automatically at system startup.

If you specify "defaults", you have specified "async, auto, dev, exec, nouser, rw, suid" mount options. Since "auto" is included, "defaults" is also a good mounting option.

The order is this ↓ 6 items Device name Mount point File system type Mount options dump flag fsck flag

① Device name Write a device file such as "/ dev / sda1", or write a specification using a label (a name given to the file system in advance) or UUID (a device-specific identifier that is not covered). When using a label, write the label name after "LABEL =", such as "LABEL = / boot". In this case the label name is "/ boot". The same applies when using UUID, and write the UUID character string after "UUID =".

② Mount point Write in the path where to mount in the root system

③ Write the file name specified by the device name

④ Mount option In the same state as async, auto, exec, nouser, rw, suid (and dev not listed in the table) are specified

(5) dump flag Write "0" or "1" whether the file system is the target of the dump command (backup command). "0" is not applicable, and "1" is applicable.

(6) fsck flag Write the priority of fsck (file system check) that is automatically performed at startup with a number. The numbers are checked in ascending order, with the exception of 0, which is specified to omit the check.

Recommended Posts

Ping-t (subject 104) device, Linux file system, FSH
Device and Linux file system
Efficient use of Linux file system
Device, Linux file system, FHS ① Memorandum Creation of partition and file system / maintenance of file system integrity
[Linux] File search
[Linux] [Initial Settings] System Settings
Linux command [File operation]
Hack Linux file descriptors
Linux system architecture [runlevel]