Linux System Management-(1)-Disk Management

Source: Internet
Author: User

Linux Disk Management



Block devices: block, Access unit "blocks", disk
Character device: Char, Access unit "character", keyboard
Device files: Associated to a device driver that can communicate with the corresponding hardware device;

Device Number:
Main device number: Major numbers, identifying device types

Second device number: Minor numbers, identifying different devices under the same type

650) this.width=650; "src=" http://img.blog.csdn.net/20150828212827762 "/>


HDD Interface type:
Parallel:
ide:133mb/s
scsi:640mb/s
Serial:
sata:6gbps
sas:6gbps
usb:480mb/s

/dev/dev_file
Device file name for disk device:

IDE
:/DEV/HD
SCSI, SATA, SAS, USB:/DEV/SD
Different devices: A-Z
/DEV/SDA,/dev/sdb, ...
Different partitions on the same device: 1, 2, ...
/DEV/SDA1,/dev/sda5

Mechanical HDD:

Slice:cylinder/

Tracks: Track

Sector:Sector
Cylindrical Surface : Parallel disks, tracks in the same position form cylinders

650) this.width=650; "src=" http://img.blog.csdn.net/20150828213136881 "/>

                  How to partition:
                     by cylinder

                 0 Track 0 sector:512bytes  (typically used for booting)
                     mbr:master Boot Record
           & nbsp;            446bytes:boot loader
                         64bytes: Partition table
                              16bytes: Identifies a partition

2BYTES:55AA for testing

# #Flash的存储位, can only change from 1 to 0, so after wiping, the unit is 1, at this time can write directly, when written 0, and then write 1 is not, must erase, erase and become 1.
Each byte is written in 55, then a AA, so that each bit is written and wiped again, indicating that the location of this byte is easy to use


4 primary partitions;
3 primary partition +1 extension (n logical partitions)

Logical Partitioning


Partition management tool: Fdisk
Fdisk: For a hard disk, you can manage up to 15 partitions;

# fdisk-l [-u] [device ...]

650) this.width=650; "src=" http://img.blog.csdn.net/20150828214542391 "/>

# fdisk Device

Subcommands: Administrative functions
P:print, showing existing partitions;

650) this.width=650; "src=" http://img.blog.csdn.net/20150828215343409 "/>

n:new, creating

650) this.width=650; "src=" http://img.blog.csdn.net/20150828215648812 "/>

d:delete, deleting

650) this.width=650; "src=" http://img.blog.csdn.net/20150828215735364 "/>

W:write, write to disk and exit
Q:quit, discard the update and exit
M: Get Help
L: The partition ID of the list

650) this.width=650; "src=" http://img.blog.csdn.net/20150828215958362 "/>

T: adjust the partition ID
650) this.width=650; "src=" http://img.blog.csdn.net/20150828220113350 "/>
Notifies the kernel to re-read the hard disk partition table:
Partx-a/dev/device
-N m:n



Linux file System management:
    linux File system: ext2, Ext3, Ext4, XFS, Btrfs, ReiserFS, JFS, swap
       &N Bsp;swap: Swap partition
         disc: iso9660
    windows:fat32, NTFS
    unix:ffs, UFS, JFS2
     Network File system: NFS, CIFS
     Clustered file system: GFS2, OCFS2
     Distributed File system: Ceph,
        moosefs, MogileFS, GlusterFS, Lustre

     Depending on whether it supports the "journal" feature:
         journaled file system: ext3, Ext4, Xfs...
         Non-journaled file systems: ext2, VFAT

     File system components:
         Modules in the kernel: Ext4, XFS, VFAT
         User space management tools: MKFS.EXT4, MKFS.XFS, Mkfs.vfat

    linux Virtual file system: VFS



To create a file system:
MKFS command:
(1) # MKFS. Fs_type/dev/device
Ext4
Xfs
Btrfs
Vfat
(2) # mkfs-t Fs_type/dev/device

-L ' LABEL ': Set volume label

Mke2fs:ext Series file system dedicated management tools
-T {EXT2|EXT3|EXT4}
-B {1024|2048|4096}
-L ' LABEL '
-j: Equivalent to-t ext3
MKFS.EXT3 = mkfs-t ext3 = mke2fs-j = Mke2fs-t ext3
-I #: Create an inode for each number of bytes in the data space, which should not be less than the size of the block;
-N #: How many inode to create for the data space;
-M #: Percentage of space reserved for managers;
-O feature[,...] : Enable the specified attribute
-O ^feature: Turn off specified attributes

650) this.width=650; "src=" http://img.blog.csdn.net/20150828221627169 "/>
Mkswap: Creating Swap partitions
Mkswap [Options] Device
-L ' LABEL '

Premise: adjust its partition ID to 82;

Other common tools:

Blkid: Block Device properties Information View

Blkid [OPTION] ... [DEVICE]
-U UUID: Find the corresponding device based on the specified UUID
-L Label: finds the corresponding device according to the specified label

E2label: Manage label for ext series File system
# E2label DEVICE [LABEL]

TUNE2FS: Reset the values of the EXT series file system adjustable parameters
-L: View the specified file system super block information; Super Block
-L ' LABEL ': Modify volume label
-M #: Fixed percentage of space reserved for administrators
-j: Upgrade ext2 to Ext3
-O: File System Properties enabled or disabled
-O: Adjust default mount options for the file system
-U uuid: Modify the UUID number;

DUMPE2FS:
-H: View Super block information

File System Detection
Fsck:file System CheCk
Fsck. Fs_type
Fsck-t Fs_type
-A: Auto fix error
-r: Interactive fix error

Note:fs_type must be the same as the file type on the partition;

E2fsck:ext series file-specific detection and repair tool
-Y: Auto answer yes;
-F: Forced repair;


Linux System Management-(1)-Disk Management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.