1. System initialization:
1 The system initialization, according to the MBR to identify the hard disk equipment.
2 include executable code to load the operating system in the MBR. This executable code is the first 446 bytes of the MBR boot loader program, boot loader.
3 The 64-byte space after the boot leader is the information that stores the partition table.
4 The relevant information of the partition table includes: The partition number, the number of the starting column and the magnetic column of the partition, so the Linux operating system can identify the hard disk device according to the information of the above 3 in the partition table.
OX5 or 0xf: An extensible partition 0x82:linux swap partition 0x83: Normal Linux partition 0x8e:linux logical volume management partition 0xfd:linux RAID partition. The MBR leaves the partition table 64 bytes, and each partition table has a size of 16 bytes, so you can divide up to 4 primary partitions on a single hard disk.
An IDE hard disk uses up to 63 partitions. A SCSI hard drive can use up to 15 partitions.
Zoning reasons: Easy to manage and control. Increase the efficiency of the system use the disk's quota feature to limit the amount of disk users use to facilitate backup and recovery 2. Use the Fdisk and Partprobe commands to manage hard disk partitions.
[Root@localhost ~]# fdisk-l/dev/sda
disk/dev/sda:17.1 GB, 17179869184 bytes 255 heads, MB
sectors/track, 2088 Cylinders
Units = cylinders of 16065 * A 8225280 bytes the
Boot Start end Device Id System
/dev/sda1 * 1 265041
/dev/sda2 Linux 1053 8193150
/dev/sda3 1054 1314 2096482+ Linux swap
/DEV/SDA4 1315 2088 6217155 5 Extended /dev/sda5 1315 2088 6217123+ Linux
Left to right explanation: 1 hard disk partition corresponding to the device file name (Device) 2) is the boot partition, with * for the boot partition, or not 3 in fact, magnetic column 4) end/end of the column 5 partition data block 6) partition number (ID) 7) partition type
[Root@localhost ~]# FDISK/DEV/SDA The number of cylinders for this disk was set to 2088. There is no wrong with then, but this are larger than 1024, and could in certain setups cause problems with:1) Softwa Re that runs in boot time (e.g., old versions of LILO) 2) booting and partitioning software to other OSs (e.g., DOS F Disk, Os/2 FDISK Command (M for help): M Command action A toggle a bootable flag is the boot disk flag for B edit BSD Diskla Bel c Toggle the DOS compatibility flag d Delete a partition delete an already existing partition L list known partition types enumerate known The partition type M print this menu lists all of the commands used in Fdisk n add a new partition to add love to a newer partition o create a empty DOS partition T Able p Print the partition table the contents of the partition Q quit without saving changes unsaved exit s create a new empty Sun dis Klabel t change a partition ' s system ID u change display/entry units v Verify the partition table W Write table to disk and exit save X Extra functionalIty (experts only)
3. Partition formatting: Use MKE2FS/DEV/SDB1 to reinitialize the partition table in the kernel using the Partprobe
Create a file system; MKE2FS [Options] Device file name-B: Define the size of the block, default 1kb-c: Before creating the file system, check the device for bad blocks-I: Define the ratio between the number of bytes and the I node, how many bytes correspond to an i node-j: Create a ext3 file system with a log. -L: Set the logical volume of the file system-M: To define the percentage of Superuser reserved disk space-N: Overrides the default value of the default I node dumpe2fs This command lists the Super block and block group information for the file system on each device
[Root@localhost ~]# dumpe2fs/dev/sda1 | More DUMPE2FS 1.35 (28-feb-2004) FileSystem volume name:/boot last mounted on: <not available> filesyste M uuid:21fbfeae-e5d2-4e52-8e68-0cc0aab4b9c1 FileSystem Magic number:0xef53 FileSystem Revision #: 1 (Dynami c) FileSystem features:has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super Default Moun T options: (None) filesystem State:clean Errors behavior:continue filesystem OS Type:linux in Ode count:66264 block count:265040 Reserved blocks count:13252 free blocks:2 37915 Free inodes:66217 the block:1 block size:1024 Fragment Size: 1024 Reserved GDT blocks:256 blocks per group:8192 fragments/group:8192 inodes per group: 2008 Inode blocks per group:251 filesystem Created:tue Oct 15:37:27 at the last Mount time: Thu Nov 10:41:04 Last Write Time:thu Nov (10:41:04) Mount count:14 Maximum Mount Count:-1 last checked:tue Oct 15:37:27 Check interval:0 (<none>) Reserve D blocks uid:0 (user root) Reserved blocks gid:0 (group root) the Inode size: 128 Journal inode:8 Default directory Hash:tea directory hash SEED:9A2E4851-9FCD-4FD9-ABDA-3FA
58d2accca Journal Backup:inode Blocks
4.EXT2 and Ext3 file systems. The two file system formats are the same, except that the Ext3 file system leaves a disk space on the last side of the hard disk partition to hold the log records. As long as you add the-j parameter to the MKE2FS command, you can format a hard disk partition into a ext3 file system.
Using the TUNE2FS command, you can convert a ext2 file system directly into a ext3 file system without losing any data.
5. Specify lable for the partition using e2lable
[Root@localhost ~]# e2label/dev/sda1
/boot
[Root@localhost ~]# E2lable/dev/sdb1/oracle
[Root@localhost ~]# blkid/dev/sda1:label= "/boot" uuid= "21fbfeae-e5d2-4e52-8e68-0cc0aab4b9c1" SEC_TYPE= "ext3"
Type= "ext2"
/dev/sda2:label= "/" uuid= "bf13b9c0-d2e8-43eb-ac26-693879e2fb4c" sec_type= "ext3" type= "ext2"
/ Dev/sda3:type= "swap"
/dev/sda5:label= "/home" uuid= "E7750c54-2d76-486d-ad05-33b8d59237d5" SEC_TYPE= "ext3" TYPE = "Ext2"
6. Mount and uninstall of file system
[Root@localhost ~]# Mount
/dev/sda2 on/type ext3 (rw)
none On/proc type proc (rw)
none On/sys type Sysfs ( RW)
None on/dev/pts type devpts (rw,gid=5,mode=620)
usbfs on/proc/bus/usb type USBFS (rw)
/dev/sda1 on/boot Type ext3 (rw)
none On/dev/shm type TMPFS (rw)
/dev/sda5 on/home type ext3 (rw)
None on/proc/sys/fs/binfmt _misc type Binfmt_misc (rw)
sunrpc on/var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
[Root@localhost ~]# Mount/dev/sdb1/oracle
Mount the Add-l parameter as a file system label.
[Root@localhost ~]# mount-l/oracle/oracle
Command format:
Mount [-t vfstype] [-O options] Device dir
which
1-T Vfstype specifies the type of file system, which is not usually required. Mount automatically selects the correct type. Common types are: CD-ROM or CD-ROM mirroring: iso9660 linux ext2 and ext3 file system DOS FAT16 file system: MSDOS
Windows 9x FAT32 file system: VFAT
Windows NT NTFS file system: NTFS
Mount Windows file network share: SMBFS
UNIX (LINUX) file network share: NFS
2.) O options are mainly used to describe the way equipment or files are hooked up. Commonly used parameters are: suid: Allow the file to be mounted love you special permissions for the system using SUID or Sgid dev: Allows the file system to be mounted to build device files, such as/DEV/SDA1 exec: executable files that can be executed after the file system is mounted. Auto: Automatically mount the file system after the computer is powered on Nouser: Only super users can mount the file system. Async: Writes data to the data buffer before writing to the hard disk.
Loop: Used to mount a file as a hard disk partition to connect the system
RO: Use read-only way to hook up equipment
RW: Hook up device with read-write mode
Iocharset: Specifies the device to be attached (mount) device to access the character set used by the file system.
4) dir device on the system of the hanging contact (mount point).
The default option for the Linxu system is to Rw,suid,dev,exec,auto,nouser,async uninstall a device: Umount device | The mount point fuser command displays the ID of the specified file or file system process, along with related information.
[Root@localhost ~]# fuser-v/
USER PID ACCESS COMMAND
/ root 1 RC . Init
root 2 RC. migration/0
root 3 RC. ksoftirqd/0
root 4 RC. events/0
Re-mount file system to read-only state
[Root@localhost ~]# Mount-o remount,ro/oracle
7. Use/etc/fstab file to mount the file system at boot time:
[Root@localhost ~]# cat/etc/fstab
# This file was edited by Fstab-sync-see ' Mans Fstab-sync ' for details
label=/< c2/>/ ext3 defaults 1 1
label=/boot /boot ext3 defaults 1 2
none/ Dev /pts devpts gid=5,mode=620 0 0
None /dev/shm tmpfs defaults 0 0
Label=/home /home ext3 defaults 1 2
none/ proc proc defaults 0 0
None /sys sysfs defaults 0 0
label=swap-sda3 swap defaults 0 0
/dev/hda /media/cdrom auto pamconsole,fscontext=system_u:object_r:removable_t, Exec,noauto,managed 0 0
Left to right explanation:
1) equipment/partition, you can use either label usage or device notation (such as:/DEV/SDB1) 2) mount point, Mount directory 3 file system type 4 option, mount this file love your system when using the option 5) Dump frequency, if 0, means no dump (dump), for 1 means to do one time, analogy 6) fsck should be the abbreviation for file system check, which indicates that the system checks the order of the filesystem when it is powered on, if 0, does not check, if 1, the first check, an analogy, a maximum of 9, If the check order is the same, the top is checked in turn.
8. Virtual Memory Management: To create a swap partition on the LINXU, you need to perform the following steps. 1 Create the partition or file used by the swap partition, and in creating partitions, you need to set the partition's type to 0x82 2 by using the Mkswap command to write a special identification on the partition or file 3 to add the mount information of the swap type file system to the/etc/fstab file. The purpose is to automatically mount this partition when Linux is automatically started. 4 If virtual memory uses the swap partition, use the SWAP-A command to start.
[Root@localhost ~]# dd If=/dev/zero of=/oracle/swapfile bs=1m count=128
DD is the conversion and copying of files, if (input file) =/dev/zero (a file with a full 0 content) of (output file) = (a file)
9. Setting of file properties in the Ext3 and ext2 file systems. 1 lsattr: This command is used to display the properties of the file 2) chattr: This command is used to change the properties of the file.
Chattr +/-/= Properties File
Option Man Manual
[Root@localhost mypro]# lsattr main.cpp
-------------main.cpp
[root@localhost
mypro]# chattr +a-main.cpp [Root@localhost mypro]# lsattr main.cpp
-----a-------main.cpp
To hook up a disc image file
Thanks to the tremendous advances in disk technology in recent years, new computer systems are equipped with high-capacity disk systems, and many people are accustomed to using software and materials as optical disc image files through virtual optical drives. This has many advantages: first, reduce the optical drive wear; two, now the hard disk capacity of large storage dozens of optical disc image file is not a problem, with Tiaogan is very convenient; third, the hard drive reading speed is much higher than the reading speed of the CD, CPU occupancy rate greatly reduced. In fact, the Linux system is more convenient to make and use optical mirrors than Windows systems, and it does not have to borrow any third party packages.
1. Make CD-ROM image files from CD-ROM. Put the CD into the CD drive and execute the following command.
#cp/dev/cdrom/home/sunky/mydisk.iso or
#dd If=/dev/cdrom Of=/home/sunky/mydisk.iso
Note: Perform any of the above commands to make the CD-ROM image file in the current CD-ROM/home/sunky/mydisk.iso
2, the files and directories made into a CD-ROM image files, to execute the following command.
#mkisofs-R-j-v Mydisk-o/home/sunky/mydisk.iso/home/sunky/mydir
Note: This command makes a CD-ROM image file of all directories and files in the/home/sunky/mydir directory/home/sunky/mydisk.iso, and the disc volume is labeled: Mydisk
3, CD-ROM image file Hook (mount)
#mkdir/mnt/vcdrom
Note: Create a directory for hanging contacts (mount point)
#mount-O loop-t iso9660/home/sunky/mydisk.iso/mnt/vcdrom
Note: Use/mnt/vcdrom to access all files in the disk image file Mydisk.iso.
Hook up a removable hard drive
For Linux systems, the USB interface's removable hard disk is treated as a SCSI device. Before you insert a mobile hard disk, you should use Fdisk–l or more/proc/partitions to view the system's hard disk and hard disk partitions.
[Root at Pldyrouter/]# fdisk-l
disk/dev/sda:73 Dot 4 GB, 73407820800 bytes
255 heads, Sectors/track, 8924 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDA1 1 4 32098+ de Dell Utility
/DEV/SDA2 * 5 2554 20482875 7 Hpfs/ntfs
/dev/sda3 2555 7904 42973875 Linux
/DEV/SDA4 7905 8924 8193150 f Win95 Ext ' d (LBA)
/dev/sda5 7905 8924 8193118+ Linux Swap
It is clear here that the system has a SCSI hard disk/DEV/SDA and its four partition/dev/sda1-/DEV/SDA4,/DEV/SDA5 is the logical partition of the partition/DEV/SDA4. After you have moved the hard disk, then use Fdisk–l or more/proc/partitions to view the system's hard disk and hard disk partition
[Root at Pldyrouter/]# fdisk-l
disk/dev/sda:73 Dot 4 GB, 73407820800 bytes
255 heads, Sectors/track, 8924 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDA1 1 4 32098+ de Dell Utility
/DEV/SDA2 * 5 2554 20482875 7 Hpfs/ntfs
/dev/sda3 2555 7904 42973875 Linux
/DEV/SDA4 7905 8924 8193150 f Win95 Ext ' d (LBA)
/dev/sda5 7905 8924 8193118+ Linux Swap
disk/dev/sdc:40.0 GB, 40007761920 bytes
255 heads, Sectors/track, 4864 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDC1 1 510 4096543+ 7 Hpfs/ntfs
/DEV/SDC2 511 4864 34973505 F Win95 Ext ' d (LBA)
/DEV/SDC5 511 4864 34973473+ b Win95 FAT32
You should be able to find one more SCSI hard drive/DEV/SDC and its two partition/DEV/SDC1,/DEV/SDC2, where/DEV/SDC5 is the logical partition of the/DEV/SDC2 partition. We can use the following command to hook up/DEV/SDC1 and/DEV/SDC5.
#mkdir-P/MNT/USBHD1
#mkdir-P/MNT/USBHD2
Note: Create a directory to use for hanging contacts (mount point)
#mount-T NTFS/DEV/SDC1/MNT/USBHD1
#mount-T VFAT/DEV/SDC5/MNT/USBHD2
Note: Disk partitions in NTFS format should use the-T NTFS parameter, and the-T VFAT parameter should be used for disk partitions in FAT32 format. If the Chinese character file name appears garbled or does not display, you can use the following command format.
#mount-T Ntfs-o iocharset=cp936/dev/sdc1/mnt/usbhd1
#mount-T Vfat-o iocharset=cp936/dev/sdc5/mnt/usbhd2
Using the Fdisk partitioning command and the Mkfs file system creation command on Linux systems, you can make partitions of a removable hard disk into a ext2, ext3 format that is unique to the Linux system. In this way, it is more convenient to use Linux. Use the following command to hook up directly.
#mount/DEV/SDC1/MNT/USBHD1
Hook up u disk
As with the USB interface of the mobile hard disk on the Linux system as a USB disk is treated as a SCSI device. Using the method is exactly the same as moving the hard disk. Before inserting a U disk, you should use Fdisk–l or more/proc/partitions to view the system's hard disk and hard disk partitions.
[Root at Pldyrouter root]# fdisk-l
disk/dev/sda:73 Dot 4 GB, 73407820800 bytes
255 heads, Sectors/track, 8924 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDA1 1 4 32098+ de Dell Utility
/DEV/SDA2 * 5 2554 20482875 7 Hpfs/ntfs
/dev/sda3 2555 7904 42973875 Linux
/DEV/SDA4 7905 8924 8193150 f Win95 Ext ' d (LBA)
/dev/sda5 7905 8924 8193118+ Linux Swap
Insert a U disk, then use Fdisk–l or more/proc/partitions to view the system's hard disk and hard disk partitions.
[Root at Pldyrouter root]# fdisk-l
disk/dev/sda:73 Dot 4 GB, 73407820800 bytes
255 heads, Sectors/track, 8924 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDA1 1 4 32098+ de Dell Utility
/DEV/SDA2 * 5 2554 20482875 7 Hpfs/ntfs
/dev/sda3 2555 7904 42973875 Linux
/DEV/SDA4 7905 8924 8193150 f Win95 Ext ' d (LBA)
/dev/sda5 7905 8924 8193118+ Linux Swap
disk/dev/sdd:131 MB, 131072000 bytes
9 Heads, Sectors/track, 888 cylinders
Units = Cylinders of 147456 bytes
Device Boot Start End Blocks Id System
/DEV/SDD1 * 1 889 127983+ b Win95 FAT32
Partition 1 has different physical/logical endings:
phys= (1000, 8) logical= (888, 7, 31)
The system has a SCSI hard drive/DEV/SDD and a disk partition/dev/sdd1,/dev/sdd1 is the U disk we want to hook up.
#mkdir-P/MNT/USB
Note: Create a directory for hanging contacts (mount point)
#mount-T Vfat/dev/sdd1/mnt/usb
Note: Now you can access the U disk by/mnt/usb, if the Chinese character file name is garbled or not displayed, you can use the following command.
#mount-T Vfat-o iocharset=cp936/dev/sdd1/mnt/usb
To hook up a Windows file share
The core of Windows network sharing is smb/cifs, where you must install and use the Samba package to connect (mount) Windows disk sharing under Linux. Most popular Linux distributions now contain samba packages, and if you install the Linux system without samba, install Samba first. Of course, can also be downloaded to the www.samba.org website ... The new version is the 3.0.10 version.
When Windows system sharing is set up, you can hook up the Linux client (mount), as follows:
# Mkdir–p/mnt/samba
Note: Create a directory for hanging contacts (mount point)
# mount-t Smbfs-o username=administrator,password=pldy123//10.140.133.23/c$/mnt/samba
Note: The Administrator and pldy123 are a user name and password for the IP address 10.140.133.23 Windows computer, and C $ is a disk share for this computer
This allows access to the files on the Windows system disk via/mnt/samba on the Linux system. The above actions were tested in Redhat as server 3, Redflag Server 4.1, SuSE Server 9 and Windows NT 4.0, Windows 2000, Windows XP, and Windows 2003.
Hook up UNIX System NFS file sharing
Similar to Windows network sharing, UNIX (Linux) systems also have their own network share, that is, NFS (Network File system), below we take the Sun Solaris2.8 and Redhat as server 3 For example, let's take a look at how to mount an NFS network share under Linux.
Before Linux client Hook (Mount) NFS disk sharing, you must first configure the NFS server.
1, the Solaris System NFS Service-side configuration method is as follows:
(1) Modify/etc/dfs/dfstab, add the shared directory
Share-f Nfs-o Rw/export/home/sunky
(2) Start NFS Service
#/etc/init.d/nfs.server Start
(3) After the NFS service is started, you can also use the following command to add new shares
# Share/export/home/sunky1
# Share/export/home/sunky2
Note:/export/home/sunky and/export/home/sunky1 are the directories to be shared
2, the Linux system NFS server configuration methods are as follows:
(1) Modify/etc/exports, add the shared directory
/export/home/sunky 10.140.133.23 (rw)
/export/home/sunky1 * (rw)
/export/home/sunky2 linux-client (rw)
Note: The Sunky, Sunky1, sunky2 in the/export/home/directory are ready to share, 10.140.133.23, *, linux-client are the IP addresses or host names that are allowed to hook up this shared Linux client. If you want to use host name linux-client you must add the Linux-client host IP definition to the server-side host/etc/hosts file. The format is as follows:
10.140.133.23 linux-client
(2) Start and stop NFS services
/etc/rc.d/init.d/portmap Start (Portmap is started by default in Redhat)
/etc/rc.d/init.d/nfs Start Server for NFS
/etc/rc.d/init.d/nfs Stop stopping NFS services
Note: If you modify the/etc/export file to add new shares, you should stop the NFS service before starting the NFS service to make the newly added share work. The same effect can be achieved by using command EXPORTFS-RV.
3, Linux client Hook (mount) other Linux systems or UNIX system NFS sharing
# Mkdir–p/mnt/nfs
Note: Create a directory for hanging contacts (mount point)
#mount-t Nfs-o RW 10.140.133.9:/export/home/sunky/mnt/nfs
Note: Here we assume that 10.140.133.9 is the host IP address of the NFS server, and of course the hostname can be used here, but the server-side IP definition must be added to the native/etc/hosts file. /export/home/sunky is a directory shared by the service side.
This makes it possible for Linux clients to access files that are shared by NFS in other Linux systems or UNIX systems via/MNT/NFS. The above actions were tested in Redhat as Server 3, Redflag server4.1, SuSE Server 9, and Solaris 7, Solaris 8, Solaris 9 for X86&SPARC environment.
Permission issues:
False server end user jack, user ID 1818, GID for 1818, client side also has a user jack, but UID and GID is 1818. The client-side Jack wants to fully read the/home/jack of the server side. The/etc/exports on the server side is
Written in this way:
/home/jack * (rw,all_squash,anonuid=1818,anongid=1818)
The setting of this means that all client-side users access server-side/home/jack this
In the catalogue, it will map to Jack (uid,gid=1818) on the server side. The results of my mount are
1. Client-side root can fully access the catalogue, including reading, writing, killing ... Wait
2. Client side of Jack (uid,gid=1818) I can do:
RM-RF server_jack/*
CP Something server_jack/
mkdir server_jack/a