Disk and Linux File System Management 4

Use the file system:
first of all to "mount": mount command and the command umount

Other file systems other than the file system in order to be accessible based, must pass the "relevance" to a directory on the root file system is implemented, this association operation is the "Mount"; this directory is the "Mount point "
mount point: mount_point, for accessing a file system of another inlet
(1) preexisting
(2) should not be used or not used by another process to a directory
(3) the original mount point the file will be hidden

mount command:
mount [-nrw] [-t vfstype] [-o Options] Device dir
command options:
-r: Readonly, read-only mount
-w: read and write, read mount
-n: By default, mounting or unmounting operation of the device will be synchronized to the / etc / mtab file; -n for disabling this feature
-t vfstype: indicates the type of file system to be mounted on the device; may be omitted in most cases, this time mount will be determined by the device will be mounted file system type blkid
-L lABEL: when mounted in a device-agnostic manner label
Mount the lABEL the dir -L
-U UUID: UUID manner specified in the device when mounting
mount -U UUID dir
-o options: mount options
sync / async: synchronous / asynchronous operation
atime / noatime: file or directory to update its access timestamp when accessed
diratime / nodiratime: whether to update its access timestamp directory when accessed
remount: re Mount
acl: supports facl function
~] # -o acl Mount Device dir
~] # tune2fs -o acl Device

ro: read only
rw: read-write
dev / nodev: whether to allow this device to create a device file
exec / noexec: whether to allow the program to run files on this device
Auto / noauto:
the User / nouser: whether to allow an ordinary user to mount the file system
suid / nosuid: whether to allow suid and sgid special permissions on files into force

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

A tip:
you can achieve the directory to another directory binding, as its temporary access entrance;
Mount --bind source directory target directory

View the current system all mounted devices:
~] # Mount
~] # CAT / etc / mtab
~] # CAT / proc / mounts

Mount the CD:
Mount -r / dev / cdrom mount_point
CD-ROM device files: / dev / cdrom, / dev / dvd

U disk loading:
prior identification device U disk file

Local loop device mount:
~] -o Loop # Mount / the PATH / the TO / SOME_LOOP_FILE MOUNT_POINT

umount命令:
umount device|dir

Note: the process of being accessed to mount point can not be uninstalled
view which is occupied by what process or
~] # lsof MOUNT_POINT
~] # fuser -v MOUNT_POINT

Kill all processes are accessing a mount point
~] # fuser -km MOUNT_POINT

: Swap partitions enable and disable
command to create a swap partition: mkswap

Enable: swapon
swapon [OPTION] [the DEVICE]
-a: Define all swap devices in / etc / fstab file
is disabled: swapoff
swapoff the DEVICE

Setting the root file system other than the file system can be automatically mounted when power: / etc / fstab file
per line to define a mounted file system and the related attributes:
six fields:
(1) to be mounted device
device file :
the LABEL
the UUID
pseudo file system: such as sysfs, proc, tmpfs, etc.
(2) mount point
swap type of device is a swap mount point
(. 3) file system type
(4) mount option
defaults: the default mount options;
If you want to mount a plurality of options specified, each other separated matter;
Defaults, ACL, the noatime, noexec
(. 5) Transfer frequency
0: backup never
1: backup day
2: backup every other day
(6) self-test sequence
0: no Self-Test
1: first, self-test, the root file system is usually only available 1
2: secondary self-test
...

mount -a: automatically mounts all defined support automatic device mounted in this file

Check disk space of two commands: df and du
df command:
df [OPTION] ... [FILE] ...
the -l: displays only information about local file
-h: Human-readable
-i: show the inode using state instead of blocks

du命令:
du [OPTION]... [FILE]...
-s:sumary
-h:human-readable

Exercise:
1, to create a partition 10G, and formatted as ext4 file system
(1) Block size is 2048; reserve space for 2%, the volume label MYDATA
(2) to mount / mydata directory, to mount when prohibited program to run automatically, and does not update the file access time stamp
(3) can be switched automatically mount
2, create a swap partition size of 1G, and since the start of the

Review: File System Management
administration tool: mkfs, mke2fs, e2label, tune2fs, dumpe2fs, e2fsck, blkid
mkfs.xfs, mkfs.vfat, fsck
mkswap, swapon, swapoff
Mount, umount
df, du

fstab file:
device file system mount point type options dump mount frequency self-test order

File system:
: Directory File
Metadata: inode, inode table
data: data blocks
filename subordinate file or directory inode corresponding relationship thereto

dentry

File name: parent directory

Delete File: all points to this file data block is marked as unused state; this mark the inode file is not used
to copy and move files:
copying: new file
move the file:
In the same file system: only change is in its path
in the different file systems: copy data to the destination file, and delete the original file

Symbolic link:
Permissions: lrwxrwxrwx
hard link: point to the same inode

 

Guess you like

Origin www.cnblogs.com/jianchen013/p/11762395.html