For Linux beginners [series 4]

Source: Internet
Author: User


Hard Disk partitioning. Before talking about this question, let me first talk about the concept question. What is the concept question? Do you remember the first time when you heard A: disk, B: disk, and drive C for the first time? Before that, you may know that the computer has a place to store data, because I have seen a tape drive on TV or advertisement (I have never known why, for a long time, a silly girl operates a junk tape device in front of a tape cabinet. default background for playing computer programs on TV stations) or hard disk image. However, you do not have a concept about how computers use these devices until the first time you press dir A: or open explorer to see the directory tree with the words a: C. If you still remember the feeling at that time, congratulations, this feeling is back.

For average people, you only need to know what computers can do. For them, the simpler and better, the less time they need to spend learning and understanding, therefore, the computer has been punched out from the beginning to the keyboard screen, and now the intelligent interaction of voice input is evolving. This is good, so that those who use computers as tools can focus more on their work (and, of course, they will pay us, the Computer builders, as appropriate ). It can be said that MS is doing well in this regard, and no one will deny that windows is a very "Easy to use" operating system. This means that you do not need to understand much about the knowledge in the chassis, or try not to understand it as much as possible, so that the computer can work for you as soon as possible. For example, you can use a complicated hard disk in the middle to create something like a C: D: E: disk, let a secretary, MM, who only needs to type, know how to store files (of course, there will also be stupid and irretrievable ). However, the problem with this (MS helps you do everything for you) is also obvious: You have no chance, or you have no chance to be forced to learn a deeper level of knowledge. And when you only know "C: D: E:" in your mind, you only have to follow windows.

OK. Hard Disk Partition for Linux installation. This problem is something that everyone is new to Linux, and even a certain level of people do not dare to make it clear or understand (including myself ). Hard Disk is a strange thing. Its basic temper is that if it is not good at all, a large piece of data will be lost, and the loss will be clean. I have seen more than once someone's graduation thesis and other things lost due to hard drive problems three days before the reply, and there is no backup! The installation of Linux must deal with the underlying part of the hard disk, rather than installing a program under win. So my first suggestion is that if there is important data on the hard disk, it is best not to rush to install Linux. A better way is to find a non-important machine, and the hard disk can be partitioned and formatted. install Linux several times more, and test the common conditions of windows and linux. In this way, you will have a bottom in your mind. If you want to install it, you must back up important data.

Next we will talk about the concept of Hard Disk in Linux. Only IDE Hard Disks are considered. Operations on a hard disk are divided into multiple layers. We need to know that the hard disk is composed of many 512-byte sectors. These sectors are organized into one "partition ". These are the same for each operating system, where each operating system manages its own partitions. For windows, it will format these partitions and manage them according to the CDE disk. Linux is different. Therefore, a hard disk can be divided into multiple partitions and multiple operating systems such as windows, Linux, and Solaris can be installed. However, because each operating system has different operations on the partition, you can only install the operating system in the partition without installing the operating system in the CDE disk (UMSDOS mode is not mentioned first ).

The first sector of each hard disk is a special sector, which does not belong to any partition. It stores two things: the first is a very small program, which is run by a computer at startup. This program is generally a Startup Program in an operating system, it starts an operating system or allows users to choose to start an operating system. The 0-sector Startup Program for Windows is very simple. It starts windows, so before that, you will not have the concept that multiple operating systems coexist on one hard disk. The Linux boot program allows you to choose which operating system to start, which is called lilo. This is something we will often encounter in the future. The zero sector also stores another important data: partition information. As mentioned above, the hard disk has a partition, so how can we split it? This information has 0 sectors. The partitioning rule for a hard disk is as follows: all sectors in a partition must be continuous, and the hard disk can have up to four partitions, the four partitions can be four primary partitions or three primary partitions plus an extended partition. You can continue to split logical partitions in extended partitions. For example, if a 10 Gb hard disk is installed on windows, there are three C: D: E disks. Then its partition can be like this:

Partition 1: 4 GB primary partition, formatted as C: Disk
Partition 2: A 4G extended partition cannot be formatted. It can only be partitioned into a logical partition.
Remaining space (three or four shards can be used) 2 GB

In the extended partition, two logical partitions are created, each of which is 2 GB and formatted as D: E: disk.

So what does it look like in Linux? Note that partitions are the same for any operating system. Although Linux does not agree with the c d e drive, these partitions are the same. Therefore, in Linux, partition 1 is used as the second-class partition. However, it has different labels and interpretations for these partitions.

In Linux, a hard disk is a device. In fact, everything in Linux is a device. For an IDE hard disk, Linux considers that there are four devices, which correspond to four devices connected to the IDE. If you have installed the machine, we know that there are two channels on the motherboard: IDE0 and IDE1. Two devices can be mounted on each slot, the primary disk and the slave disk. These disks can be hard disks or optical drives. So how does Linux consider these devices? In Linux, these devices are marked with/dev/hdx. The main disk on IDE0 is/dev/hda, the slave disk is hdb, and so on. If you can have multiple IDE slots, you can continue to hde hdf. In short, the device connected to each hard disk is considered as a/dev/hdx device by Linux. If your machine is the master disk in the IDE0 slot, It is hda. If the master disk in the IDE1 slot is an optical drive, it is hdc. In windows, fdisk operates on Hard Disk 1 and Hard Disk 2, while in linux, fdisk operates on/dev/hda,/dev/hdb, and so on. This is flexible and intuitive, isn't it?

What about partitions in Linux? In Linux, the partition concept is that each partition on the hard disk is also a device (again ). Their logo is/dev/hdxy, where hdx indicates the hard disk in front of the root, and y indicates the Partition Number. Take hda as an example. Hda1 is the first partition, and hda4 is the fourth partition location. Logical partitions start with hda5. In that example, Linux seems to have 10 Gb hda. Hda1 is the primary partition in the format of windows. Hda2 is an extended partition with hda5 and hda6 in the format of windows. You can create hda3 and hda4. Note that logical partitions cannot be created because the hda2 space has been fully divided.

These hard disk items are easy to mix up. We recommend that you use more practices to summarize them. You can refer to some related books. Some early DOS books are introduced in the installation section. Currently, many linux installations are available. There are also some introductions on the Internet.

Understand how Linux processes partitions. It is the partition policy. Start with RH6.2 and press enter until the default settings are selected. Here, you need to tell the linux installer where to install linux on the hard disk. You need to tell it some information, including, how big is to create a new Linux partition, and where to mount it. Here we need to introduce the concept of mount.

We know that hard disks can be divided into many partitions. Each partition is formatted by each operating system and can be used. However, you must use one method. In windows, or DOS, the format partition is mounted (or mounted) into a C: D: E: disk. The distribution of drive letters is determined by the operating system (you can specify it after NT ). In Linux, you must specify how to use a partition. In Linux, partitions are not allocated according to C: D: E, but mounted to a directory. The entire UNIX bucket structure is a directory tree (rather than each C: D: E: has its own directory tree ). The top layer is the root directory (in/format, note that it is not a windows backslash). There are other directories at the root level. First, you need to mount a partition to/, then create another directory under the root, and then mount the partition to these directories. Therefore, a unix storage system is a directory tree, but it can contain many partitions and even other storage devices, such as optical drives, memory disks, or network disks.

In addition to/, several directories are pre-created during Linux installation. What we need to know is/usr,/home, And/root. No matter what they do first, generally we need to allocate a space, specify it as the Linux Native type, and then mount point is one of these directories. In addition, note that there are two types of Linux partitions. native can store files and create directories. There is also a linux swap, which is a linux memory swap partition, you must specify one when installing RH. Therefore, at least one partition is required during installation. The linux native type is mounted to/, and a partition type is linux swap. The swap area is not mounted to any directory, the system processes them separately.

It is about the partition size. For Linux installation, the size of 1 GB space is almost/. For the convenience of the first installation, you can create a 2 GB partition mount point as/and then a swap. The size of the swap is as large as the memory size. The maximum size is 128 MB. During subsequent installation, you can create other partitions based on your requirements for the hard disk to mount, for example,/home.

For a machine that has already installed Windows, you can delete a windows partition in the Linux installer, which is generally a logical partition (you don't want to delete a C: disk ), then create Linux partitions in its space.

Linux/can be a primary partition or a logical partition. But you need to pay attention to the 8 GB problem. I think you may have heard of 8 GB. What is 8 GB? The specific problem is complicated. Simply put, the Linux/partition cannot be mounted to a partition after 8 GB of hard disk. So if your hard disk has 16 GB, the first 6 GB has been allocated to the C: disk, and then there are two 5 gb d: E: disks in it, you have to delete the D drive partition and create a Linux partition instead of an E drive, because the e drive is later than 8 GB. 8 GB later Linux installation is normal, but it cannot be started. Of course, there is a solution, but I suggest you follow the simplest situation in the new user's status and practice other things in the future.

After partitioning, you are asked to configure other things. Including the root password, Lilo, network configuration, and X. Lilo is an important part. You will be asked to install lilo on the MBR, partition start sector, or a floppy disk. You need to choose whether to install MBR or floppy. Generally, you can install it on the MBR. you can install it on a floppy disk for the sake of security. In this way, the hard disk can be used to start the machine or the windows one. You can use a floppy disk to start the machine in linux. Note that you need to disable Virus Warning in BIOS; otherwise, it cannot be installed on MBR.

If your machine configuration is more standard, the NIC, sound card, and display card can be detected automatically, press enter all the way, and then start it to go to Linux. If you are not lucky (most of the time), it doesn't matter if the NIC sound card is not properly configured at startup. You can reconfigure it in the future like windows. In short, these will not affect your installation.

OK, machine restart, unlike the past is not seen Starting MS Windows 98... but a Lilo: prompt. This indicates that Lilo has been installed properly. Press enter to enter Linux. If you want to enter Windows, you can press DOS and then press Enter. If you specify different windows partition start flags, you can use the [TAB] key to see which options you have.

This is a frequently asked question. Let's talk about it here. For some reason, if you want to delete Linux, you know to use the DOS disk to start and then fdisk to delete Linux partitions or reinstall NT to delete Linux partitions. However, windows cannot be started after everything is installed. Lilo: this symbol is always there, and the machine is dead. Do not repartition and format. Then, a half-bottle of vinegar may tell you that "there is no rescue, please wait ". Remember, unless the hardware is damaged, the hard disk does not require a low level at any time. This is because other installers do not overwrite 0 sectors, that is, the lilo caused by MBR cannot be deleted. The solution is very simple. Remember to use a DOS disk to start and run the DOS fdisk/MBR. This command is to rewrite the 0-sector boot program to the standard MS program, that is, the DOS, Windows, WindowsNT, Windows 2000 can be started, without changing any other information in the hard disk partition. Therefore, it is absolutely secure, absolutely secure, and absolutely secure. When Lilo cannot be deleted, remember fdisk/MBR.

OK. You have successfully started Linux and entered a graphic or character interface that requires logon. You have a bunch of questions to ask. Next, I will explain how to ask questions and find help.

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.