Device files are stored in the/dev directory This file provides some information about the device, file type B, C, p, s start file or directory is a device file, roughly for a few /DEV/SDA is the first interface type device for SATA. /DEV/HDB Second IDE type interface Device block device: If SDA1 is a block device, its capacity size fixed character device: such as the printer, it does not have a fixed capacity size, when the character device read and write, the kernel will be read and write to the corresponding device equipment: a pipe, there are in and out, A local socket device that directs data to need: The pair interface used when communicating across processesFile System TypeJust like the file system format under Windows FAT16, FAT32, Ntfs,linux have ext2 3 4 xfs file types to choose from Ext4 and XFS are newer file types, different types of file systems differ in read/write speed, random read/write speed, lookup operation,How many fragments are produced,The amount of time and speed required to extract the fragments from the Operation
Disk partitioning
Case
/DEV/SDA1 boot partition
/DEV/SDA2 Swap partition
/DEV/SDA3 Root Partition
#以SATA接口的硬盘为例
fdisk -l #查看所有硬盘和分区信息
fdisk /dev/sda
#进入fdisk模式
输入 n 建立引导分区
输入 p 确认创建主分区
输入1此为分区号
输入起始位置回车
输入结束位置+300M
输入 a
输入1
#这样一个300M启动分区建立完成,并设置为启动状态,键入print可查看到 boot处有*标志
#建立swap分区
输入 n 建立交换分区
输入 p 确认创建主分区
输入2分区号
输入起始位置回车
输入结束位置+1024M
输入 t 设置分区类型
输入82此为交换分区类型
输入 print 查看当前分区信息
#建立根分区
输入 n
输入 p 确认创建主分区
输入3分区号
输入起始位置回车
输入结束位置回车使用剩余全部空间
#完成键入 print查看分区信息
输入 w 对分区操作进行保存
Calling ioctl() to re-read partition table.Syncing disks.
Next you need to format the partition
mkfs.ext3 /dev/sda1
mkfs.ext4 /dev/sda3
mkswap /dev/sda2
Collection of commands available in Fdisk mode
Command(m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition‘s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Disk Mount
#mount 将要挂载的文件的格式 文件位置 挂载点
mount -t iso9660 /dev/dvd /mnt # 挂载光驱
mount -t ntfs-3g/dev/sdc1 /media/cdrom # 挂载ntfs硬盘
mount -t vfat /dev/sda1 /mnt/usb # 挂载USB
mount -o loop /xxx/**.iso /mnt/ # 挂载xxx目录下的镜像文件到mnt目录
mount -t nfs 192.168.1.1:/home/aaa /home/bbb/mt
#将NFS服务器上home目录下的aaa文件夹 挂载到本机home目录下bbb目录的mt目录下
Device monitoring
udevadm monitor
Can monitor the usage record of USB stick,Udevadm is a common management tool for other uses, you can use the manUdevadm ViewView disk Information
df #显示磁盘使用信息
du #显示目录或文件占用磁盘信息
quota #显示磁盘已使用和空间限额信息
LVMLVM is a shorthand for Logical Volume Manager (Logical Volume management), which is a mechanism for managing disk partitions in a Linux environment. When partitioning a system, how to accurately evaluateallocate the capacity of each hard disk partition, as the system administrator takes into account not only the capacity required by the current partition, but also the maximum amount of capacity that may be required after the partition. Because if the estimate is inaccurate, the administrator may even want to back up the entire system, clear the hard disk, re-partition the hard disk, and then restore the data to the new partition when a partition is not sufficient. LVM is a logical layer built on hard disks and partitions to improve the flexibility of disk partition management. The LVM system administrator makes it easy to manage disk partitions, such as connecting several disk partitions to a single block of volume group (volumegroup), forming a storage pool. Administrators can create logical volume groups (logicalvolumes) at will on a volume group and further create file systems on logical volume groups. LVM makes it easy for administrators to resize storage volume groups and to name, manage, and assign disk storage as a group. (The content of this paragraph from Baidu Encyclopedia)
GRUB Boot Process(1) the BIOS or boot firmware loads and runs the boot loader. (2) The boot loader locates the kernel image on the disk, loads it into memory, and starts it. (3) The kernel initializes the device and device driver. (4) The kernel mounts the root file system. (5) The kernel uses the process number as a PID to run a program called INIT, User space starts at this time. (6) Init initiates other system processes. (7) Init also initiates a process that typically occurs at the end of the process and is responsible for user logons. Start the run Level 3-bit command-line mode, and 5 for the graphical interface mode. You can modify the boot level in the/etc/inittab file to require root permissions
From for notes (Wiz)
#4. Device Management for Linux