Linux Disk Management
I/O port:i/o device Address
Block devices: block, Access unit "blocks", disk
Character device: Char, Access unit "character", keyboard
Device files: Associate to a device driver to enable communication with the corresponding hardware device
Device number: Primary device number secondary device number
Device files have only source data (attributes), no data, are special types of files, directories are also
/dev/dev_file's here.
The interface type of the hard disk:
Parallel (slower than serial):
IDE 133mb/s (interface rate)
SCSI 640mb/s
Serial:
STAT 6Gbps
SAS 6gbs+
USB 480mb/s
Speed: rpm
Device file command mode for disk devices:
IDE:/DEV/HD
SCSI,SATA,SAS,USB:/DEV/SD
CentOS 6 starts with SD
Different devices: A-Z logo/dev/sda/dev/sdb ....
Different partitions for the same device: 1, 2, 3 .... /DEV/SDA1,/dev/sda2 ... .
Mechanical hard disk working mechanism:
Track: Tracks
Cylinder: Cylinder surface
Sector: Sector (512 bytes -4k)
How to Partition:
Partitioning by cylinders
0 cylindrical faces are reserved (512 bytes).
MBR (master boot record main boot record): 46bytes: Storage partition table (each 16 bytes identifies a zone with one pointing to the extended partition (n logical partitions)), 446bytes:boot loader, 2BYTES:55AA
4 Primary partitions: 3 primary partitions + one extension (n logical partitions)
Greater than 2T, to use gpt,http://www.iruanmi.com/what-is-gpt-and-what-is-uefi/
Partition management tools: Fdisk, parted, Sfdisk
FDISK: Only 15 partitions can be managed for a single drive
Fdisk-l (with * number is the boot partition)
Fdisk device:
Sub-command:
P: Show existing partitions
N: Create a new partition
D: Delete
W: Write Update, save exit
Q: Give up
M: Get Help
L: List the partition ID
T: Adjust partition ID (Linux 83, 82)
To see if the kernel has identified a new partition:
Cat/proc/partations should appear on your new partition, otherwise it will not be written
Notifies the kernel to re-read the partition table
Partx-a/dev/device
Partx-n m:n indicate from which to which number
cat/proc/partations
You can also kpartx-a/dev/device (CentOS 5 without this tool, using Partprobe/dev/device)
Linux File System Management
Linux file systems: ext2, Ext3, Ext4, XFS, Btrfs, ReiserFS, JFS, swap
Swap: Swap partition
Windows:fat43,ntfs
Unix:ffs, UFS, JFS2
Network File system: NFS, CIFS
Cluster file system: GFS2, OCFS2
Distributed File systems: Ceph, Moosefs, Mgilefs, GlusterFS, Lustre
Depending on whether it supports the "journal" feature:
journaled file system: ext3, Ext4, XFS ...
Non-log file system: Ext2, VFAT
Part of the file system:
Modules in the kernel: EXT4, XFS
User space management tools: MKFS.EXT4, MKFS.XFS, Mkfs.vfat
Virtual file system for Linux: NFS
To create a file system:
To view supported file systems: Cat/proc/filesystems
MKFS command:
(1) # MKFS. Fs_type/dev/device
Xfs
Btrfs
Vfat
(2) # mkfs-t Fs_type/edv/device
-L "lable": Set the volume label
Mke2fs:ext Series file system dedicated management tools
-t {ext2| EXT3|EXT4}
-B {1024|2048|4096} indicates block size
-L "Label" volume label
-j: Log, equivalent to-t ext3
-I #: Create an inode for each number of bytes in the data space, should not be small block size,
Blkid: Viewing block device property information
E2label: lable # E2label Device for managing EXT Series File Systems
TUNE2FS: Reset the values of the EXT series file system adjustable parameters
-L: View information for the specified file system super block
-L: Modify the volume label
DUMPE2FS:-H View Super block information
Mkswap: Creating Swap partitions
-L:
File System Detection:
Fsck:file System Check
-T Fs_type: detects a specific file system and must be the same as the file type already on the partition
-A: Auto fix error
-R: Interactive Repair
E2fsck:ext Series special detection and Repair tool
-F: Forced repair
-Y: Auto Answer Yes
File System Management:
Establish a relationship between an additional file system and an existing directory of the root filesystem, which can be used as an entry for other files, Mount
Disassociate relationship Offload
Associate Device mount point: Mount,
When uninstalling, you can use the device, or you can use the mount point Umount
Note: The existing files under mount point will be temporarily hidden after the mount is completed
Mount method: Mount DEVICE Mount_point
Mount: Displays all devices that are already mounted on the current system
Device: Indicates which devices to mount
(1): Device files: e.g./dev/sda3
(2): Volume Label:-L "Label" such as-L "mydate"
(3): UUID:-U "UUID" for example:-U ""
(4): Pseudo file system name: Proc, SYSFS, Devtmpsfs, Configfs
Dir: Mount point
Pre-existing: Recommended use of empty directory
The device in process use cannot be uninstalled
Common options:
-T Vsftype: Specifies the type of file system on the device you want to mount
-r:readonly: Read-only Mount
-w:read and write read-write mount
-N: Do not update/etc/mtab (track all mounts and uninstalls)
-A: Automatically mounts all devices that support automatic mounts (defined in the/etc/fstab file, with the "Auto Mount" feature in the Mount option)
-V: Show Mount Process
View all mounted devices tracked by the kernel: cat/proc/mounts
-O Options:
Async: Async Mode
Sync: Synchronous mode
Atime/noatime: Synchronization timestamp (default Notaime) (contains directories and files)
Diratime/nodiratime: Access timestamp for directory
Auto/noauto: Whether auto-mount default auto is supported
Exec/noexec: Whether to support running applications on the file system as a process
Uninstall command:
Umount DEVICE
Umount Mount_point
See who is using the mount point fuser-v/mydate/fuser-km/mydate/Delete user
Mount Swap partition:
Enabled: Swapon
-A: Activate all swap partitions
-P Priority: Specify precedence
Disabled: Swapoff
Memory space usage Status: free-m or-G
File Space Usage Status View tool: Df-h or-iinode Usage-p uses POSIX format output
View the overall space consumption status of a directory
Du disk useage
Du Dir-h-S: Show total size
File Mount Profile:/etc/fstab
Each row defines a file system to mount
Device to mount or pseudo file system mount point file System type Mount options dump frequency self-test order
Link file:
Hard Links: cannot be done on the directory, not across partitions
Multiple different paths to an inode, creating a hard link to a file creates a new reference path for the inode, thus increasing its reference count
Symbolic Links: You can make a directory, cross-partition, point to the path of another file, whose size is the length of the path string, without increasing or decreasing the reference count of the target file Inode
ln [-SV] SRC dest-s: Soft Connection
Impact of file management operations on files
File Delete: File reference count is 0, idle
File copy: Creates a new empty file and populates the data with the new empty file. Involves read-out and write
File move: Copy and delete, path change (just move the reference path of the original data)
This article is from the "Vulcan and Fire" blog, make sure to keep this source http://notezr.blog.51cto.com/9424982/1918968
Linux Disk Management