On the hard disk:
Heads read and write data, the disk does not contact, but the distance was suspended very close to the disk surface. If for some reason, the head came into contact with the disk, it will have devastating consequences.
Hard disk partition:
IDE hard disk is generally divided into hard drives, SCSI drives and SATA drives. In Linux, IDE excuse devices are called hd, SCSI and SATA device interface is called sd. SDA is referred to as the first hard disk, the second block is called sdb, and so on. Linux provides a hard drive can only exist on four primary partitions, are named sda1, sda2, sda3 and sda4. 5 start identifier from the logical partitions, each logical partition a plurality, it adds 1 to the end of the partition number. There is no limit to the number of logical partitions.
Generally, each system requires a primary partition to boot. Each partition stored with the system boot program parameters necessary. In the Windows environment often said that a primary partition C drive, it is the first hard disk partition, called sda1 under Linux. Thereafter the D, E, F, etc. to the logical partition corresponding to sda5 under Linux, sda6, sda7 ... .... OS partition installed in the main body can also be installed in a logical partition, the master boot program must be installed in the partition.
Linux file system:
ext3fs
and
ext4fs
, an increase of 4
log function
, when the system crashes, you can use the log file to restore the system, largely to avoid the loss of data. Log inspection mechanisms to check the time required for each file system is about 1 second, which means that disaster recovery hardly any time delay.
ReiserFS
file system, the new algorithm can take into account simultaneously Reiser4 speed and disk utilization, and other file systems often requires a system administrator to choose between these two areas
swap
: swap partition can be understood as virtual memory. The actual memory is not enough, a part of the operating system temporarily without data taken from memory and placed in the swap. Windows will not swap partition dividing a single, but the use of
the paging file
to achieve the same functionality.
Mount the file system:
Use CD or USB as an example, to quickly get started:
You can use df -h to view the current status of the device to mount, to mount the cdrom can replace sdb1 USB, and under normal circumstances would be USB / dev / sdb1 device file
sudo mkdir / mnt / cdrom ## / To create a new directory (mount point)
Mount -r sudo
/ dev / cdrom / mnt / cdrom ##
mount the
CD to this new directory
Now, you can access the CD-ROM cdrom through the directory / mnt /.
cd /mnt/cdrom
ls ## View CD contents
cd / ## Exit / mnt / cdrom directory
umount sudo
/ dev / cdrom ##
uninstall
CD
umount sudo
-r / dev / sda1 ##
-r
guidance in the case can not be uninstalled umount the file system, read-only try to reload
-r
and
-w
are designated as read-only and read-write mounted device.
-w is the default
When it starts to mount file systems: / etc / fstab file
Linux configuration file
/ etc / fstab file
to determine how the system is mounted hard drive, and the information required to mount those partitions at boot
List information are: to mount a UUID of each file system (used to refer to the device name),
Mount point;
Type of file system;
Various mount options;
Backup frequency;
In order to check the process of restarting the file system.
Linux under representation of the device
All of the devices under Linux is treated as a file operation, in Linux, every device is mapped to a particular file, this file is called "
device files
."
All the Linux device files in the / dev directory under most of these documents is
a block device file
and
a character device file
. Block can be random access devices; character device sequentially receives only "character stream file device users can not access the storage device, all of the storage devices before use, must be mounted directly to a directory, then it can operate. the operation of this directory as a storage device.
View disk usage: df
df (-h)
Some important statistics entire file system ## df command will collect and collate current already mounted
-a list of all file system
-h easy to read fashion show
-T file system type
-i display inode information
... ...
DF (-t ext4)
## displays the file system type ext4
-t [file system type] to display only the specified type of file system disk information
-x [file system type] does not display the specified type of file system disk information
Check and repair the file system: fsck
sudo fsck /dev/sda1
sudo fsck -p (without the device file) ## fsck command with the -p option, reads fstab file to determine which file system check,
## and finally a sequence of fields specified, the file system checks The digital by each record in ascending order.
## If the two numbers are the same as the file system, so fsck will also check them. Typically, fsck -p will automatically run when the hard disk
A file system (format) on the disk: mkfs
the sudo
the mkfs -t
ext3 / dev / sdb1 formatter ## / dev / sdb1 as ext4 format (format ext4 defaults)
the sudo
the mkfs
-t ext4
-c
/ dev / sdb1 -c option block ## to check the damage on the specified device
Partition type
Primary partition: a total of a maximum of four extended partition: There can be only one primary partition is also regarded as a kind, that is primary partitions plus an extended partition up to four. However, the extended partition can not be formatted and stored data must then be divided into logical partitions to use. Logical partitions: logical partitions in the extended partition divided, if an IDE hard disk, Linux supports up to 59 logical partitions, if the IDE hard disk, Linux supports up to 59 logical partitions, if SCSI hard disk Linux supports up to 11 logical partitions
Zoning
Primary partition 1: / dev / sda1
primary partition 2: / dev / sda2
Primary partition 3: / dev / sda3 extended partition: / dev / sda4 logical partition 1: / dev / sda5 logical partition 2: / dev / sda6 logical partition 3: / dev / sda7
Partition device file name: primary partition 1: / dev / sda1 extended partition: / dev / sda2 logical partition 1: / dev / sda5 logical partition 2: / dev / sda6 logical partition 3: / dev / sda7
Why logical partition 1, instead of starting from / dev / sda3? As / dev / sda1, / dev / sda2, / dev / sda3, / dev / sda4 only to the primary and extended partitions use, with only one primary partition and one extended partition
file system
ext2: ext file system is an upgraded version of the previous version of Red Hat Linux7.2 system default is ext2 file system. Released in 1993, 16TB maximum support and maximum 2TB partition files. ext3: ext3 file system is an upgraded version of the ext2 file system, the biggest difference is that with a log function to enhance the file system when the system suddenly stopped reliability, maximum support partitioning and maximum 2TB 16TB of files. ext4: It is the ext3 file system upgrade. ext4 extensive improvements in performance, scalability, and reliability. EXT4 change can be said upside down, backward compatible such EXT3, and 16TB maximum 1EB file system files, an unlimited number of subdirectories, Extents contiguous block concept, multi-block allocation, assignment delay, the pre-allocated persistent, fast FSCK, check the log no log mode, online defragmentation, inode enhanced default startup barrier and so on. Centos6.3 is the default file system. 1EB = 1024PB = 1024 * 1024TB summary: Centos6.3 default file system EXT4 EXT4 more advanced and able to support larger storage partitions, as well as individual files greater storage efficiency faster and write more secure, more reliable data strong
Installing a hard disk and partition: fdisk
1. Use fdisk partition table established
2. Use the mkfs file system build ext3fs:
3. Use fsck to check the file system
4. Test Partition
5. Create and activate the swap
6. fstab configuration file