Linux disk partitioning, formatting, verification, mounting basic tutorial

  
 

Disk partition: fdisk [-l] Device name Format: mkfs [-t file system format] Device name

Disk check: fsck [-t file system] [-ACay] Device name

-A : Scan the required device according to the contents of /etc/fstab

-a : Automatically repair the problematic magnetic area, so you don't have to press y 啰!

-y : Similar to -a, but some filesystems only support the -y parameter!

-C : You can use a bar graph to show the current progress during the inspection process!

External options for EXT2/EXT3: (provided by e2fsck)

-f : Forced check! In general, if fsck does not find any unclean flags, it will not actively enter the detail check.

If you want to force fsck to go into the detail check, you must add the -f flag!

-D : Optimizing the directory under the file system


mounting: mount [-t file system] [-L label name] [- o Extra Options] [-n] Device Name Mount Point

Options and Parameters:

-a : All unmounted disks according to the configuration file /etc/fstab Mounted up

-l : ​​A simple input mount will display the information currently mounted. Add -l to add a Label name!

-t : Very similar to the mkfs option, you can add a file system type to specify the type to be mounted.

Common Linux support types are: ext2, ext3, vfat, reiserfs, iso9660 (disc format),

nfs, cifs, smbfs (these three are network file system types)< Br>

-n: In the default case, the system will immediately write the actual mount to /etc/mtab to facilitate the operation of other programs

. However, in some cases (such as single-person maintenance mode), in order to avoid problems, it will be deliberately not written.

You have to use this -n option at this time.

-L : In addition to using the device file name (such as /dev/hdc6), the system can also use the file system's header name

(Label) for mounting. It's best to take a unique name for your file system!

-o : You can pick up some additional parameters when mounting! For example, account number, password, read and write permissions, etc.:

ro, rw: Mount the file system to become read-only (ro) or read-write (rw)

async, sync: This file Whether the system uses synchronous write (sync) or asynchronous (async)

memory mechanism, please refer to the file system operation mode. The default is async.

auto, noauto: Allow this partition to be mounted automatically with mount -a (auto)

dev, nodev: Is this partition allowed to create device files? Dev is allowed

suid, nosuid: Is this partition allowed for suid/sgid file format?

exec, noexec: Is there an executable binary file on this partition?

user, nouser: Is this partition allowed to let any user execute mount? In general,

mount can only be done by root, but releasing the user parameter allows

general users to also mount this partition.

defaults: The default values ​​are: rw, suid, dev, exec, auto, nouser, and async

remount: remount, this is a system error, or when the parameters are re-updated. Very useful!


Unloading device: umount [-fn] Device name or mount point

-f : Force uninstall!

-n : Uninstalling without updating /etc/mtab


Disk parameter modification: mknod device name [bcp] [major] [minor]

b : Set the device name to a peripheral storage device file, such as a hard disk, etc.;

c : Set the device name to become a peripheral input device file, such as a mouse/keyboard;

p : Set the device name to be a FIFO file;

major: main device code;

minor: secondary device code;

common hard disk device code :

Disk name Major Minor

/dev/hda 3 0~63

/dev/hdb 3 64~127

/dev/Sda 8 0-15

/dev/sdb 8 16-31

Example: mknod /dev/sda5 b 8 10


Modify the file system Dart head: e2label device name new label name

Example: e2label /dev/sda3 "my_test"


tune2fs [-jlL] device code

-l : ​​function similar to dumpe2fs -h ~ read out the data in superblock

-j : convert ext2 filesystem to ext3 file system

-L : similar to e2label Function, you can modify fi Lesystem's Label

Example: tune2fs -l /dev/sda3


Special device loop mount (images are mounted without burning)

Example: mount -o loop /root/centos5.iso /mnt


Swivespace:

Create a new swap space: mkswap device name or file name

Start swap space: swapon device name or file name

turn off swapfile:swapoff device name or file name

Copyright © Windows knowledge All Rights Reserved