Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Disk and file system management

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

We know that a disk can be partitioned into multiple partitions (partition). From Windows's point of view, you may have a disk and partition it into CRV, DRV, E: disk, that C, D partition E is the partition. Linux devices exist in the form of files, and different disk device interfaces have long resulted in different disk file names. That is, the disk device file names of the IDE interface are all in the format of / dev/hd [amerz], for example: / dev/hda./dev/hdb. The file names of disk devices for SCSI, SATA, SAS and USB interfaces are all: / dev/sd [a murz], for example, sda.sdb. The naming of disk devices is mainly based on the order in which the disk is detected by the Linux core. For example, if you have two hard drives with SATA interface, you need to insert them on the motherboard with six SATA slots, one on the SATA1 interface and the other on the STAT3 interface, because the detected order is used to determine the device file name. It has nothing to do with the actual slot code, so the two disks are named / dev/sda on the SATA1 slot and / dev/sdb on the SATA3 slot. Then the representation of different partitions on the same device is 1.2.3.4.5 so the partition on / dev/sda disk is named / dev/sda1,/dev/sda2.... Note: both centos6 and centos7 identify the hard disk device file as / dev/sda [a Murz] #

Disk partition

Two partition methods: MBR, GPT

Early Linux systems were compatible with Windows disks, so they used MBR (Master Boot Record, the main boot log area) that supports Windows to handle boot managers and partition tables! On the other hand, the boot manager record area and partition table are all placed in the first sector of the disk, which is usually the size of 512Bytes (the old disk sector is 512Bytes), so the first sector and (0 sector) 512Byte will have two data.

Main boot recording area (Master Boot Record, MBR): mainly used to boot the system, with 446 Bytes

Partition table (partition table): records the status of the partition of the entire hard disk, with 64 Bytes

Since the partition table is located in a block with only 64 Bytes capacity and each partition occupies 16Bytes, a maximum of 4 partitions can be recorded, and each record area records the cylindrical numbers at the beginning and end of the section. Assuming that the device name is / dev/sda/, then the four partitions are named / dev/sda1,sda2,sda3,sda4. These four partitions are also known as primary partitions and extended partitions, usually these four partitions are three primary partitions and one extended partition, and the extended partition can extend N logical partitions (note: once the extended partition is used, that is, this extended partition does not store actual data, but stores information pointing to the logical partition, and the device name of the logical partition can only start with 5. )

GPT supports 128partitions, there is no so-called primary, extended, logical partition concept, each can be regarded as a primary partition, using 64-bit, support 8Z (512Byte/block) 64Z (4096Byte/block) GPT disk partition structure to solve the shortcomings of MBR can only be divided into four primary partitions, and support large hard disk, partition structure is clear and simple and there is backup.

Use 128bit UUID to indicate that the disk and partition GPT partition tables are automatically backed up at the beginning and the end, with CRC check bits

UEFI (Unified extended firmware Interface) hardware supports GPT to enable the operating system to boot

Structure such as

Protect MBR area: similar to MBR mode, record boot information program.

GPT header: this part records the location and size of the partition table itself, as well as the location of the GPT partition used for backup, and places the check code (CRC32) of the partition table. The operating system can judge whether the GPT is correct according to this check code. If there is an error, you can also use this record area to get the backup GPT (the last backup block of the disk) to restore the normal operation of GPT!

Partition table: partition information office for actual recording

Administrative Partition tool; fdisk,parted,sfdisk

Fdisk creates MBR partitions and also supports GPT. For a hard disk, a maximum of 15 partitions can be managed.

Gdisk creates GPT Partition

GNU parted advanced partition operations (create, copy, resize, etc.)

Partprobe- resets the kernel partition table version in memory

Fdisk / dev/sdb

GPT Partition tool for gfisk / dev/sdb Class fdisk

Fdisk command

Fdisk-l [- u] [device...]: lists partitions on specified disk devices; view partition information for disks

] # fdisk-l / dev/sdaDisk / dev/sda: 128.8 GB, 128849018880 bytes255 heads, 63 sectors/track 15665 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000e3d03 = Device Boot Start End Blocks Id System/dev/sda1 * 1 64 512000 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 64 15666 125316096 8e Linux LVM

Above, you can see that the device name is / dev/sda, the size is 128G, and so on. The following column shows partition information. You can see that there are currently two partitions, sda1 and sda2, while sda1 is used as the boot partition of the system, starting cylinder 1, ending cylinder 64, block size, partition type ID, etc. (note For cenots6, start is the start cylinder, End is the end cylinder, for centos7 start is the start sector, and End is the end sector)

Fdisk device (device)

Fdisk provides an interactive interface to manage partitions, which has many subcommands for different management functions; all operations are performed in memory and are not synchronized directly to disk; it will not take effect until the w command is saved to disk

N: create a new partition

D: delete existing partitions

T: modify the partition type

L: view all known id

W: save and exit

Q: do not save and exit

M: view help information

P: show existing partition information

Example

] # fdisk / dev/sdaWARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u') .Command (m for help): n enter n to create a new partition Command action e extended: extended partition p primary partition (1-4): primary partition p: enter p to create primary partition Partition number (1-4): 3 Select primary partition number First cylinder (7859-15665) Default 7859): from which cylinder does Using default value 7859 directly enter Last cylinder, + cylinders or + size {K Magna M default G} (7859-15665, default 15665): + 10G create a 10G partition here add 10G Command (m for help): P enter the p command to see that the / dev/sda3 main partition has been created successfully Disk / dev/sda: 128.8 GB, 128849018880 bytes255 heads, 63 sectors/track 15665 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x0004badb Device Boot Start End Blocks Id System/dev/sda1 * 1 26 204800 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 26 7859 62914560 8e Linux LVM/dev/sda3 7859 9164 10489446 83 LinuxCommand (m for help): n next you can continue to create partitions But now that we have created three primary partitions, if we want to create a primary partition, we have to use all the remaining disk space (a disk can only have up to four primary partitions), otherwise the remaining space will not be available. If we want to create a few more partitions, here we choose to create an extended partition. Command action e extended p primary partition (1-4) eSelected partition 4First cylinder (9165-15665, default 9165): (hit enter directly here This means that all the starting cylinder 9165 to the end cylinder 15665 will be assigned to this extended partition) Using default value 9165Last cylinder, + cylinders or + size {K Using default value 15665Command M Jing G} (9165-15665, default 15665): Using default value 15665Command (m for help): P tap again to see that the extended partition numbered 4 has been created Disk / dev/sda: 128.8 GB, 128849018880 bytes255 heads, 63 sectors/track 15665 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x0004badb Device Boot Start End Blocks Id System/dev/sda1 * 1 26 204800 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 26 7859 62914560 8e Linux LVM/dev/sda3 7859 9164 10489446 83 Linux/dev/sda4 9165 15665 52219282 + 5 ExtendedCommand (m for help): n knock n again to continue to create logical partitions If you exit directly and use the fdisk command to create a new extended partition again, you can also create a logical partition, as follows: Command (m for help): nCommand action l logical (5 or over) p primary partition (1-4) l click l to select create logical partition First cylinder (7859-15665, default 7859): logical partition start cylinder Direct enter defaults to 7859 (you only need to enter the cylinder number if you specify the starting cylinder) Using default value 7859: directly hit enter defaults to 7859 to start Last cylinder, + cylinders or + size {K _ Magne M _ G} (7859-15665, default 15665): + 10G enter 10G to choose to create a 10G logical partition Command (m for help): P to display the partition list You can see that the / dev/sda5 logical partition has been created successfully Disk / dev/sda: 128.8 GB, 128849018880 bytes255 heads, 63 sectors/track 15665 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x0004badb Device Boot Start End Blocks Id System/dev/sda1 * 1 26 204800 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 26 7859 62914560 8e Linux LVM/dev/sda4 7859 15665 62708728 + 5 Extended/dev/sda5 7859 9164 10489414 + 83 LinuxCommand (m for help): W knock w to save exit. At this point, you will be prompted that the device resource is busy with The partition table has been altered calling ioctl () to re-read partition table.WARNING: Re-reading the partition table failed with error 16: Device or resource busy.The kernel still uses the old table. The new table will be used atthe next reboot or after you run partprobe (8) or kpartx (8) Syncing disks.

Execute cat / proc/partitions to check the device list and find that sda3,4,5 is not recognized by the kernel

] # cat / proc/partitions major minor # blocks name 80 125829120 sda 8 1 204800 sda1 82 62914560 sda2 253 0 20971520 dm-0 253 1 2097152 dm-1 253 2 10485760 dm-2 253 3 20971520 dm-3

Execute partx-a / dev/sda. (synchronize partition list) to have the kernel reread the device, not once, just twice

] # partx-a / dev/sda

Then cat / proc/partitions again

] # cat / proc/partitions major minor # blocks name 80 125829120 sda 8 1 204800 sda1 82 62914560 sda2 Note: there is no click w to save exit when creating sda3 due to misoperation here. All unseen sda3 8 4 31 sda4 85 10489414 sda5 253 0 20971520 dm-0 253 1 2097152 dm-1 253 2 10485760 dm-2 253 20971520 dm-3

Note: a new partition created on a disk device that has already been partitioned and one of which has been mounted may not be directly recognized by the kernel after the creation is complete.

View: cat / prot/partitions

Notify the kernel to force rereading the disk partition table

Centos5:partprobe [device]

Centos6,7:partx,kpartx

Partx-a [device]

Kpartx-af [device]

Sometimes it may need to be executed twice.

At this point, the partition is created.

The complete example is as follows

[root@localhost ~] # fdisk / dev/sdaWARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): nCommand action e extended p primary partition (1-4) pPartition number (1-4): 3First cylinder (7859-15665, default 7859): Using default value 7859Last cylinder, + cylinders or + size {K Magazine G} (7859-15665, default 15665): + 10GCommand (m for help): pDisk / dev/sda: 128.8 GB, 128849018880 bytes255 heads, 63 sectors/track 15665 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000483ba Device Boot Start End Blocks Id System/dev/sda1 * 1 26 204800 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 26 7859 62914560 8e Linux LVM/dev/sda3 7859 9164 10489446 83 LinuxCommand (m for help): nCommand action e extended p primary partition (1-4) eSelected partition 4First cylinder (9165-15665 Default 9165): Using default value 9165Last cylinder, + cylinders or + size {K Magna M default G} (9165-15665, default 15665): Using default value 15665Command (m for help): pDisk / dev/sda: 128.8 GB, 128849018880 bytes255 heads, 63 sectors/track 15665 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000483ba Device Boot Start End Blocks Id System/dev/sda1 * 1 26 204800 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 26 7859 62914560 8e Linux LVM/dev/sda3 7859 9164 10489446 83 Linux/dev/sda4 9165 15665 52219282 + 5 ExtendedCommand (m for help): nFirst cylinder (9165-15665) Default 9165): Using default value 9165Last cylinder, + cylinders or + size {K Magna M default G} (9165-15665, default 15665): + 10GCommand (m for help): pDisk / dev/sda: 128.8 GB, 128849018880 bytes255 heads, 63 sectors/track 15665 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000483ba Device Boot Start End Blocks Id System/dev/sda1 * 1 26 204800 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 26 7859 62914560 8e Linux LVM/dev/sda3 7859 9164 10489446 83 Linux/dev/sda4 9165 15665 52219282 + 5 Extended/dev/sda5 9165 10470 10490413 + 83 LinuxCommand (m for help): wThe partition table has been altered calling ioctl () to re-read partition table.WARNING: Re-reading the partition table failed with error 16: Device or resource busy.The kernel still uses the old table. The new table will be used atthe next reboot or after you run partprobe (8) or kpartx (8) Syncing disks. [root@localhost ~] # partx-a / dev/sdaBLKPG: Device or resource busyerror adding partition 1BLKPG: Device or resource busyerror adding partition 2 [root@localhost ~] # partx-a / dev/sdaBLKPG: Device or resource busyerror adding partition 1BLKPG: Device or resource busyerror adding partition 2BLKPG: Device or resource busyerror adding partition 3BLKPG: Device or resource busyerror adding partition 4BLKPG: Device or resource busyerror adding partition 5

Delete partition for

Partx-d-n MRU N / dev/DEVICE

Centos6:-nr Nmurm

CentOS 5, 7: using partprobe

Partprobe [/ dev/DEVICE]

Modify the partition type

Take the sixth partition as an example as follows

] # fdisk / dev/sdaCommand (m for help): l click l to view partition type 0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris 1 FAT12 39 Plan 9 82 Linux swap / So C1 DRDOS/sec (FAT-Command (m for help): t type t option to modify partition type Partition number (1-6): 6 type the partition number to be modified Hex code (type L to) List codes): 82 Type number Command (m for help): P check the list again / dev/sda6 10471 10732 2104483 + 82 Linux swap / Solaris modified successfully

After the modification is successful, now that the disk partition and the partition type have been modified, let's enter the file system under the disk partition.

File system management tools:

Create File system tool

Mkfs

Mkfs.ext2 (no logging function), mkfs.ext3,mkfs.ext4,mkfs.xfs,mkfs.vfat...

Tools for detecting and repairing file systems

Fsck

Fsck.ext2,fsck.ext3,..

Tools for viewing its properties

Dumpe2fs,tune2fs

Adjust file system properties:

Tune2fs

Components of the kernel file system:

If a file system wants to run on the system, the corresponding module must be mounted

Lsmod: check the modules that have been loaded in the current system kernel. If the kernel recognizes a file system accordingly, you must load this module first.

File system driver: provided by the kernel

File system management tools: provided by applications in user space

Management tools for ext series file systems:

Mkfs. Multiple file series can be seen in two tab

Mkfs.ext2,mkfs.ext3,mkfs.ext4 (forward compatibility with older versions)

Mkfs-t ext2=mkfs.ext2

Ext2: there is no log function. Ext3,4 has log function. Ext4 performance has been greatly improved. It is recommended to use ext4 file system.

Command

Mkfs.ext2 / dev/sda# (hit enter and finish formatting the file system)

[root@localhost ~] # mkfs.ext2 / dev/sda6mke2fs 1.41.12 (17-May-2010) Filesystem label= file system volume label, which is not specified here, so it is an empty OS type: Linux operating system type Block size=4096 (log=2) block size. The default is 4KFragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks131648 inodes, and how many inode have been created for this partition by 526120 blocks. And how many blocks 26306 blocks (5.00%) reserved for the super user in which multiple blocks are reserved for the Super Admin, the default is the total number of blocks 5%First data block=0 the number of the first block starts from 0, the largest block number of the Maximum filesystem blocks=541065216 file system is 17 block groups, the total number of blocks is 32768 blocks per group, and how many blocks are there in each group of 32768 fragments per group 7744 inodes per group how many inodeSuperblock backups stored on blocks are in each group: which blocks are backed up with block numbers 32768, 98304, 163840, 229376, 294912Writing inode tables: done is being written to the inode table, which shows that the write completed Writing superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 34 mounts or180 days, whichever comes first. Use tune2fs-c or-i to override.

Blkid / dev/sda#

You can view file system types

Example

] # blkid / dev/sda6/dev/sda6: UUID= "8353a98f-ac7f-413c-a79a-8277ad2a71ba" TYPE= "ext2"

Each device has a random UUID; global unique identifier

Execute mkfs.ext3 / dev/sda6 again to format the ext2 file system as ext3.

] # mkfs.ext3 / dev/sda6Writing inode tables: done Creating journal (16384 blocks): done added a successful log creation item, because the ext3 file system supports logging.

Of course, this format can also be ext4 format, ext4 format also supports logging, and the size of a single file and a single file system is more powerful than ext3

Centos6 does not support xfs by default

If you want to install the xfsprogs tool first; you can install it with yum, and then execute] # mkfs.xfs / dev/sda6-f to force the file system to be formatted as xfs

# mkfs.xfs / dev/sda6-f

Ext series special management tool for file system: mke2fs

Mke2fs [option] device

-t {ext2 | ext3 | ext4}: indicates the type of file system to be created

Mkfs.etx4=mkfs-t ext4=mke2fs-t ext4

-b {1024 | 2048 | 4096}: indicates the block size of the file system

Example

] # mke2fs-b 1024 / dev/sda6

-L LABEL: indicates the volume label

] # mke2fs-t ext2-L mydata-b 2048 / dev/sda6

-j: create a journaling file system ext3

Mke2fs-j = mke2fs-t ext3 = mkfs-t ext3 = mkfs.ext3

] # mke2fs-j / dev/sda6

-i#:bytes-per-inode: indicates the ratio of inode to bytes; that is, an inode is created for every number of bytes

-inode: directly indicates the number of NVs to be created for this file system

-masking: specify the reserved space, percentage

-O [^] FEATURE: creates the destination file system with the specified property. No ^ means to enable this feature, and ^ means to disable it.

E2label command: viewing and setting of volume label

Viewing: e2label device

] # e2label / dev/sda6

Settings: e2label device LABEL

] # e2label / dev/sda6ali] # e2label / dev/sda6ali

Tune2fs command: view or modify some properties of the ext system file system

Adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems:

Note: the block size cannot be modified after it is created

Tune2fs [option] device

-l: view the contents of the super block

] # tune2fs-l / dev/sda6tune2fs 1.41.12 (17-May-2010) Filesystem volume name: ali volume label Last mounted on: when was the last time it was mounted, the current display shows the magic number of unavailable Filesystem UUID: 32592f02-1828-416d-8ef5-4bdcf2d46935 UUIDFilesystem magic number: 0xEF53 file system Special identification of file system type Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype sparse_super large_file Filesystem flags: signed_directory_hash Default mount options: (none) default mount option Filesystem state: clean file system status where clean indicates that there is no file corruption Errors behavior: ContinueFilesystem OS type: LinuxInode count: 131648 inode quantity Block count: 526120 block quantity Reserved block count: 26306 Free blocks: 500671 number of remaining blocks Free inodes: 131637 remaining inode quantity First block: 0Block size: 4096 block size Fragment size: 4096 Reserved GDT blocks: 128Block Blocks per reserved for GDT Group: 32768 how many blocks per group Fragments per group: 32768 how many fragments per group Inodes per group: 7744 how many blocks per group inodeInode blocks per group: 32768 how many blocks per group are used to put inodeFilesystem created: Wed Aug 24 21:07:43 2016Last mount time: n/aLast write time: Wed Aug 24 21:20:40 2016Mount count: 0Maximum mount count: 20Last checked: Wed Aug 24 21:07:43 2016Check interval: 15552000 (6 months) Next check after: Mon Feb 20 21:07:43 2017Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11Inode size: 256Required extra isize: 28Desired extra isize: 28Journal inode: 8Default directory hash: half_md4Directory Hash Seed: 14d62c4d-b7bd-4458-abc9-72a48dbf45ccJournal backup: inode blocks

Modify the properties of the specified file system

-j:ext2-- > ext3

-L:LABEL: modify the volume label

-m #: adjust the percentage of reserved space

-O [^] FEATHER: turn a feature on or off

-o [^] mount_option: turns some default mount option on or off

Acl

^ acl

Dumpe2fs command: displays attribute information for ext series file system

Dumpe2fs [- h] device

Tools to implement file system detection

When the write operation is abnormally terminated due to non-process termination or system crash, the file may be corrupted. At this point, the file system should be detected and repaired. It is recommended to proceed offline.

Special tools for ext series files

E2fsck:check a Linux ext2/ext3/ext4 file system

E2fsck[option] device

-y: automatically answer yes to all questions

-f: force detection even if the file system is in the clean state

Fsck:check and repair a Linux file system (common to all file systems)

The working feature of repair is to delete discontiguous files

-t fstype: indicates the file system type

Fsck-t ext4 = fsck.ext4

-a: automatically fix all errors without interaction; (not recommended)

-r: interactive repair

Centos6 if you use the xfs file system

# yum-y install xfsprogs

Create: mkfs.xfs

Detection: fsck.xfs

Blkid command:

Blkid device

Blkid-L label: positioned as a device according to label

Blkid-U UUID: locate the device according to UUID

Swap file system

Swap partitions on linux must use separate file systems

And the system id of the file system must be 82

Create swap device: mkswap command

Mkswap [option] device

-L label: indicates the volume label

-f: mandatory

] # mkswap / dev/sda6Setting up swapspace version 1, size = 2104476 KiBno label, UUID=7e42ac9c-21f4-45b4-80b3-830d6e12611b

Create a windows file system

# mkfs.vfat device

Windows does not recognize the file system of linux; therefore, when a storage device requires cross-use between two systems, it should use a file system that is supported by both windows and linux; fat32 (vfat)

Use of the file system:

First mount: mount command and umount command

In order to be accessible to a file system other than the file system, it must be "associated" to a directory on the root file system, which is the "mount point".

Mount point: mount_point, which is used as an access entry to another file system

(1) exist beforehand

(2) directories that are not or will not be used by other processes should be used.

(3) the original files under the mount point will be hidden.

Mount command:

Mount [- nrw] [- fnrsvw] [- t vfstype] [- o options] device dir

Command options:

-r:readonly, read-only mount

-w:read and write, read write mount

-n: by default, device mount or unmount operations are synchronously updated to the / etc/mtab file;-n is used to disable this feature

-t vfstype: indicates the file system lightning on the device to be mounted. In most cases, it can be omitted. In this case, mount will use blkid to determine the file system type of the device to be mounted.

-L LABEL: indicates the device by volume label when mounting

Mount-L LABEL dir

-U UUID: indicates the device in UUID mode when mounting

-o option: mounting option

Sync/async: synchronous / asynchronous operation

Atime/noatime: whether a file or directory updates its access timestamp when it is accessed

Diratime/nodirname: whether the directory updates its access timestamp when it is accessed

Remount: remount

Acl: supports the use of facl features

# mount-o acl device dir

# tune2fs-o acl device

Ro: read-only

Rw: read and write

Dev/nodev: whether creating device files is allowed on this device

Exec/noexec: whether to allow running program files on this device

Auto/noauto:

User/nouser: whether to allow ordinary users to mount this file system

Suid/nosuid: whether to allow suid and sgid special permissions on program files to take effect

Defaults:Use default options: rw, suid, dev, exec, auto, nouser, async, and relatime.

A technique to use:

You can bind a directory to another directory as its temporary access entry

Mount-- bind source directory target directory

View all mounted devices on the current system

# mount

# cat / etc/matb

# cat / proc/mounts

Mount the CD

Mount-r / dev/cdrom mount_point

CD device file: / dev/cdrom

Mount the USB flash drive:

Implement the device file to identify the u disk

Umount command:

Umount device | dir

Note: the mount point being accessed by the process cannot be uninstalled

Check which process or processes are used by:

# lsof mount_point

# fuser-v mount_point

Terminate all processes that are accessing a mount point

# fuser-km mount_point

Mount the local loopback device

# mount-o loop / path/to/some_loop_file mount_point

Enable and disable swap partitions:

Command to create a swap partition: mkswap

Enable: swapon

Swap [option] [option]

-a: all swap devices defined in the / etc/fstab file

Disable: swapoff

Swapoff device

Set the file system other than the root file system to be automatically mounted when it is powered on: / etc/fstab file

Each line defines a file system to be mounted and its related properties

6 fields:

(1) equipment to be mounted

Device file

LABEL

UUID

Pseudo file system: such as sysfs,proc,tmpts

(2) Mount point

The mount point for devices of type swap is swap

(3) File system type:

(4) Mount option

Defaults: use the default mount options:

If you want to specify multiple mount options at the same time, separate them with commas

(5) dump frequency (backup)

0: never back up

1: backup every day

2: backup every other day

(6) self-check order

0: no self-test

1: self-test first, usually only if the root file system is available 1

2: secondary self-test

Mount-a: the supported auto-mount devices defined in this file can be mounted automatically

Two commands: df and du

Df command:

Df[option]... [file]

-l: displays only relevant information about local files

-h:human-readable

-I: displays the usage status of inode instead of blocks

Du command:

Du[option]... [file]

-s:sumary

-h:human-readble

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report