A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service
1. Part IV Lesson Four: disk partitioning and completing Ubuntu installation
2, the first part of lesson five: Unity Desktop, life if only as first sightDisk partitioning
Last lesson we formally began to install Ubuntu, but to the partition of that step, but the small series but stopped. What's the situation?
Please do not beat me, if you really want to flat, then please "sea-flat", let me Once (love) enough (think of Yu Cheng Qing's "Let Me Love Once Enough"), experience a su wu feeling.
This is the case: disk partitioning is an important and difficult point of knowledge.
So we use this lesson alone to talk about the concept of disk partitioning, the composition of disks, the file system, and so on.
Disk partitioning should be a critical step in installing a Linux system. It can divide our hard drive into several areas, especially if it is a necessary step to install a dual system, such as installing a Linux system outside of the Windows operating system.
The advantage of partitioning a hard drive is that our operating system does not interfere with each other and can be on the job.
So before we go on to the next step of installing Ubuntu, we need to learn what the disk partitions and disk partitions do.
Note: If you want to install a dual system, such as installing Ubuntu outside of windows, or installing Ubuntu outside of Mac OS, please back up the original system beforehand. Although the steps in our course are a little bit, there should be no fuss. But disk partitioning is risky: good points, great joy, bad points, epic.
In a word, prudence is good.
Lift the lid of the disk to
Let's take a look at the hard drive in this chapter. Hard disk is generally called HDD.
Current drives are generally divided into HDDs (hard disk drives, traditional disk-drive HDDs) and SSDs (solid state disk, SSD).
The hard disk we have shown below is HDD. SSDs are hot in recent years, and many people now buy computers that like to be equipped with SSDs, which are expensive but much faster than traditional disk drives.
What does a typical computer's hard disk look like:
Did you see it? The above is the approximate appearance of the hard disk.
What does it look like inside a hard drive?
Not a bit like a phonograph. The phonograph is a record that spins and then "reads" The data from the head.
Although the hard drive is usually not a disk, but a few disks stacked together, but the principle and the phonograph is a bit like, the speed of the hard disk is much higher than the phonograph, the hard disk is the head to read and write data.
Compare HDD hard drives (left) and SSD drives (right):
Traditional mechanical hard disk (HDD): The disc, the head, the hinge, the control motor and other components. The disc rotates at work and the head position is read and written at the specified position of the platter, in a sense similar to the structure of the old phonograph. The advantages of traditional hard disk are large capacity, low cost, and long life span, which is suitable for large-capacity data writing, but the shortcomings are very obvious, such as large volume weight, high heat quantity, slow speed, non-seismic, noise and so on.
SSD: Typically made with NAND flash. Because there is no mechanical parts, so the stability, noise, heat, shock resistance is better than the traditional mechanical hard disk, in addition to read and write faster. Of course, the cost of flash memory is higher, so the price of SSDs is also higher. Take the same 1TB capacity for example, the traditional mechanical hard disk only about 500 yuan, while the SSD will need at least 2000 yuan.
How the hard drive stores data
The hard drive consists of one to several high-speed rotating disks and a magnetic head placed on the actuator boom.
Storing and retrieving digital data on a flat magnetic surface, the information is written to the disk by an electromagnetic flow that changes polarity by a magnetic head that is close to the magnet surface, and the information can be read in the opposite way, such as when the magnetic field causes changes in the electrical signal in the coil when the reading head is above the recorded data.
Physical structure of the disk
The physical structure of the hard disk is generally composed of the head and the disc, the motor, the main control chip and the line, and so on; when the main motor drives the disc, the secondary motor drives a group (head) onto the corresponding disc and determines whether to read the front or the opposite side of the disc, The magnetic head is suspended on the disc to draw a concentric circular track (magnetic track or cylindrical surface), at this time by the magnetic head of magneto-inductive coil sensing disc on the disk with the use of the drive specified by the manufacturer of the read or data interval to locate the sector, thereby obtaining the data content of the sector.
Track: When the disk is rotated and the head remains in one position, each head will draw a circular trajectory on the disk surface called the track.
Cylinder: A cylindrical face (Cylinder) consisting of a plurality of tracks of different platters, but one in which the same radius circle is in a disk group consisting of multiple platters.
Sector: Each track on a disk is divided into segments that are sectors of the hard disk (Sector). The first sector of a hard disk, called a boot sector.
Head (head): The key part of hard disk reading data, its main function is to convert the magnetic information stored on the hard disk disc into an electrical signal outward transmission, and it works by using the resistance value of the special material to read and write the data on the disk with the principle of the magnetic field change, The magnetic head is good or bad to a large extent determines the storage density of the hard disk disc.
Platters (Platter): The media on the hard disk that hosts the data store. Hard disk disc is a rugged material for the disk base, the magnetic powder attached to the aluminum alloy (new material also useful glass) disc surface, the surface is processed quite smooth. These magnetic powders are divided into concentric circles called tracks, and on each concentric circular track there is an infinite number of arbitrarily arranged small magnets that represent the state of 0 and 1, respectively. When these small magnets are affected by magnetic forces from the head, the direction of their alignment changes. The magnetic force of a magnetic head is used to control the direction of certain small magnets, so that each small magnet can store information. The hard disk is superimposed by multiple platters, separated from each other by washers.
Note: Each platter has two sides, so it also corresponds to 2 heads per disc.
Logical structure of the disk
When the operating system (Windows,linux or Mac OS) reads and writes to the hard disk, the file system is used to combine the sectors of the hard disk into clusters, and the file and tree directory system is created to make the operating system easy to access and find. This is because it can be cumbersome for the operating system to address a large number of sectors directly.
D: Cluster (Cluster, Sector Group)
Locate a data record location on the hard disk: sector. Three-dimensional positioning was used.
Defragment a disk
Knowing the fundamentals of hard drives, let's go on to disk defragmentation.
What is defrag?
In fact, as the name implies, we can guess roughly a sorta.
Disk defragmentation simply means that the fragmented and messy files generated by computer disks during long-term use are re-organized through system software or professional Disk Defragmenter software, which improves the overall performance and speed of the computer.
Disk fragmentation should be referred to as file fragmentation because files are scattered across different parts of the disk, rather than being kept in contiguous clusters of disks.
After a hard drive has been in use for a period of time, due to repeated writes and deletions of files, the free sector in the disk is dispersed across the entire disk in a discontinuous physical location, so that the file cannot exist in a contiguous sector. In this way, to read and write to the file, you need to go to different places, to increase the head of the move back and forth, reducing the disk access speed.
Before disk defragmentation:
After defragmenting the disk:
Benefits of Disk Defragmentation:
After defragmentation, the files on our hard disk are compact and will not be scattered everywhere. This allows us to read and write data without having to go to different places to extract it. Our operating system can run faster (if you've been using a computer for years, and you've never had a disk defragmentation, and suddenly done it, it's a bit more obvious).
The second benefit is very useful to us in this lesson. Because this lesson is mainly about partitioning the disk in order to properly arrange our Linux operating system and the Windows operating system. Defragmentation is well-prepared for disk partitioning. If you do not defragment, there may be some risk (rare) that some of the operating system's files will disappear due to disk partitioning, which will make your Windows system unstable.
Because defragmentation is almost harmless, it's a good idea to do a "defrag" of our Windows systems before starting to install our Ubuntu system. This will make our hard drive more "clean", "regular".
Below is a demonstration of how to defragment Win7:
1. Disk Defragmenter, System tools, accessories, all programs, starting with
2. After clicking on "Disk Defragmenter", the following window will appear:
3. Click the "Analyze Disk" button
4. After the analysis can be organized, click the "Defragment Disk" button
Note: During the Disk Cleanup process, try not to shut down the computer or restart, and try not to move the computer, otherwise it may damage the disk. Generally speaking, there is no big problem. However, we should take care of our computer brother carefully so that it can serve us better.
What is a disk partition
To better explain the partitioning of the disks, we use some diagrams to illustrate them.
First, we compare your current hard drive to a circle, such as:
We can see: If you have a Windows operating system on your hard drive, the general impression is this.
We can say that at this time the hard disk is mostly windows, since the Windows operating system is a big one, then it is basically able to store files on the hard disk with its own intention.
If we install the Linux operating system at this time, because it is not possible to install two operating systems in the same place on the hard disk, it scientists invented the "disk partition" (the partition of English is "Partition").
Disk partitioning is simply to use the partition editor (partition Editor) to partition a few logical parts of the disk, fortunately it is not really take a knife hard disk cutting into several pieces, partition is the concept of virtual.
Suppose we divide the hard disk into half-partitioned, 50% to linux,50% to Windows, then the hard disk case is as follows:
In this way, the two operating systems can coexist peacefully.
In each partition, the files are stored and organized in a certain way, which we call the file system.
Users can use the file system to save data without having to worry about how much data is actually stored on the hard disk (or CD) with the address of the data block, just remember the directory and file name of the file.
The file system also stipulates who has the right to access this or that document. A large number of modern file systems are log file systems (journaling files system), where the log file system is more likely to be consistent and faster to recover when a file system fails (such as a kernel crash or sudden power outage).
Strictly speaking, a file system is a set of abstract data types that implement operations such as storage of data, hierarchical organization, access, and acquisition.
One important rule: there can only be one file system per partition!
There are many different kinds of file systems. Let's meet for a moment:
Microsoft (Microsoft) file systems (including DOS and Windows operating systems)
FAT16: A file system with a certain age that can manage partitions of no more than 4GB. Many Chinese sources say that FAT16 can only manage partitions that are not larger than 2GB, because they are based on Dos,win 95,win 98 and the Win me operating system, where it is true that FAT16 can only manage partitions that are not larger than 2GB. But the information in English (Microsoft Official Microsoft Profile) shows that 4GB, is said to be on the Windows XP system to manage up to no more than 4GB partitions.
Why is it 4GB? Because 16 in FAT16 represents a 16-bit cluster (cluster, which previously said that cluster is the meaning of multiple sectors, typically 512 bytes per sector), the maximum size of clusters in a Windows XP system FAT16 file system can be up to 65,536 bytes. 2 of the 16-time Square is 65536. So 65536 * 65536 = 4294967296 = 4 * 1024 * 1024 * 1024, so it is 4GB (1 GB = 1024x768 MB = 1024x768 * 1024x768 = 1024x768 * 1024x768 * 1024x768) B. Here b is the abbreviation for byte, 1024 is 2 of the 10-time Square). The Dos,win 95,win 98 and the Win me operating system, the maximum cluster is 32,768 bytes, so FAT16 in these operating systems can only manage the 2GB size of the partition. FAT16 is used in DOS operating systems to Windows XP (derived from Windows NT systems).
FAT32: Popular from Win 98, is an enhanced version of FAT32. You can manage partitions that are not larger than 2TB (1TB = 1024GB, so 2TB = 2048GB). FAT16 and FAT32 This pair of "Fat Brothers Combination" (Fat is English "fat" meaning. Of course, fat is the abbreviation for File Allocation table, which means that the "Files Allocation table" is hooping in the production of disk fragmentation, because there is a flaw in the management of clusters, it is possible to waste space, do not explain in depth, otherwise today's class is not finished. So for both of these file systems, you need to defragment your disk frequently, or your partitions will become more and more chaotic.
NTFS: In the win NT operating system for the first time, we also know that the win NT evolved to win XP, until now the win 10, in fact, is the win NT kernel continues to evolve. So NTFS is the new technology file system, the NT (new technology) filesystem. NTFS can manage 16Eo partitions (that is, approximately 16000000000 GB), which is a theoretical value, of course.
NTFS also stores data files in clusters, but the size of the clusters in NTFS does not depend on the size of the disk or partition. The shrinking of the cluster size not only reduces the wasted disk space, but also reduces the possibility of generating disk fragmentation. Compared to the FAT file system, NTFS can recover data more easily when a system failure or sudden power outage occurs because it is a journaled file system. NTFS can also encrypt files, compress them, and so on. But it also produces disk fragmentation, which is just a lot better than the FAT file system.
Of course, the earlier file system also has fat12,fat8 and so on.
I think beginners see the above clusters, sectors, bytes, 1024,4gb,16eo and so on, are not all going crazy.
It doesn't matter, learn slowly and understand. It's not too much to remember the concept or understand it for the time being.
File systems for Linux
Ext2: This filesystem has been used for a long time under Linux. Ext is the first three letters of the English extended, which means "extended". Designed by French programmer Remy Card, he is also the designer of ext (first-generation extended file system). Little pride, because the small part of living in France. One of the advantages of the Ext file system is that disk fragmentation is rarely generated, so disk defragmentation is generally not required under Linux systems.
Ext3:ext3 and ext2 are very close, but ext3 is a journaled file system, so ext2 (not datejust), ext3 can recover data in the case of a failure. Ext3 and ext2 are highly compatible.
The evolution of the EXT4:EXT3 expands the size of the disk partitions, further reducing the chance of disk fragmentation.
So Ext2,ext3 and Ext4 are second Extended Filesystem,third Extended Filesystem and fourth Extended Filesystem abbreviations, representing the second generation of extended file systems, Third-generation extended file systems and fourth-generation extended file systems.
What file system do you choose?
So what file system do we choose?
For now, many Windows operating systems still use the NTFS file system, and many Linux operating systems use the Ext3 file system.
But we must catch up with the times and be capricious. So we chose Ext4 as the file system for Linux. After all, EXT4 performance is better than ext3.
You ready? to partition the disk.
The last lesson forgot to say one thing, because the last lesson did not talk about the concepts of disk and disk partitioning.
Before installing Ubuntu, it's a good idea to put the installation partition for Ubuntu system under Windows.
Under Windows, right click on my Computer "management" Disk Management, select a larger disk, right-select the compressed volume. In the Ubuntu14.04 divided into 80G space (the size of the space according to their own needs to choose, if only installation as a practice to use 30G on it. If you have a running program or want to work with the data or suggest a little more space. But now the general computer hard disk is very large, and some are 1TB, why not more points to Ubuntu it. Remember the small part of the 2011 installed Ubuntu 10.04 when the 60GB to Ubuntu, set a good size after the point compression can be, do not have to set the drive letter, we install Ubuntu and then re-partition.
Note: This partition we do not have a direct view of the Ubuntu partition in Win7, but in Ubuntu we can access anything placed on the hard drive, that is, you can view the partition of the Win7 system directly.
If you don't do this before you install Ubuntu, you might want to start over again (that is, cancel the current installation during the previous lesson's installation and try again).
Of course, it is also possible to separate the Ubuntu system from the Ubuntu installation process, but it is possible to accidentally erase some of the key partitions of windows, such as the recovery partition (for recovering the system).
So we're assuming that the reader has already given Ubuntu a good partition, and then the last step in the previous lesson is to say:
In the last lesson, our final step is something like this:
You can see that there are many devices. What/DEV/SDA, it contains the/dev/sda1,/dev/sda5,/dev/sda6 below.
What is the meaning of these SDA?
These are actually the names of the disk partitions under Linux. Dev is the first three letters of the English device that represents the equipment files.
First letter: H or S. H represents the hard disk of the IDE interface. s represents the hard disk of the SATA or SCSI interface.
A second letter: Always d. The first letter of the English drive, which indicates the disk drives.
Third letter: A,b,c,d, et cetera. Represents the order.
Hda generally refers to the IDE interface of the hard disk, HDA generally refers to the first hard disk (disk), similar to the HDB,HDC and so on.
SDA generally refers to the SATA or SCSI interface of the hard disk, SDA generally refers to the first hard disk (disk), similar to SDB,SDC and so on.
So sda1 refers to the first partition of the first hard drive, Sda5 is the fifth partition of the first hard drive, and so on.
SDB1 is the first partition of the second hard drive, and so on.
Now the kernel will be hard disk, mobile hard disk, such as a U disk recognition as SDX form.
We notice that there is also a free partition (the white one), the size is 85.9GB, this is actually the beginning of our windows to the Ubuntu out of the 80GB space.
So now we're going to operate this free "Partition" to schedule the Ubuntu we're about to install.
Mouse to select it, click the "+" sign below, will pop up the following dialog box:
The type of the new partition select logical partition, which is used to select Swap space.
The swap partition is also called the Swap partition, which is the virtual memory partition under Linux.
It does this by virtualizing the disk space (that is, the swap partition) into memory after the physical memory is used.
It acts like a swap file for Windows systems, but it is a contiguous disk space and is not visible to users.
It is important to note that although this swap partition can be used as "virtual" memory, it is much slower than physical memory.
Therefore, if the need for faster speed, and can not send great expectations of swap, the best way is still to increase physical memory, swap partition is only a temporary solution.
So for the swap partition, we'll assign it the same size as your computer's memory. The example gives 8000MB, which is less than 8GB (assuming memory is 8GB).
Primary and logical partitions
Primary partition: English is primary Partition. Also known as the primary disk partition, as the extended partition, logical partition, is a type of partition. Other types of partitions can no longer be partitioned in the primary partition, so each primary partition is equivalent to a logical disk (the primary partition is similar to the logical partition at this point, but the primary partition is partitioned directly on the hard disk, and the logical partition must be built into the extended partition). The early MBR mode partition can only partition four partitions, and now the GPT partition is divided into at least 128 primary partitions, it is likely that there will be no concept of extended partitioning and logical partitioning in the future. The primary partition of a hard disk contains the hard disk partitions of the files and data necessary to boot the operating system, and the hard disk must have a primary partition to install the operating system on the hard disk
Logical partition: English is logical Partition. is a contiguous area of the hard disk, except that each primary partition can be divided into only one drive, and each primary partition has its own independent boot block, which can be set to ScanDisk with Fdisk. There can be up to 4 primary partitions on a hard disk, and multiple logical drives can be divided on the extended partition. These logical drives do not have a separate boot block and cannot be set to ScanDisk with Fdisk.
After the swap partition is allocated, we assign the boot partition, which is the partition where the program booting the operating system is located. Very important.
In Win XP and Win 7 and win 8 and win 10, our operation is not the same.
In Win7 or Win XP, create a new partition, click "+", set the Ubuntu boot boot area, generally divided 200Mb enough, as shown in:
In Win 8 or win 10, create a new partition, click "+", set the Ubuntu boot boot area for EFI boot partition, generally divide hundreds of MB enough, as shown in:
The root partition, or partition, corresponds to the Windows system's C drive. In the Linux system,/is the topmost directory.
/The following will have other folders, such as home, user, bin, Dev, tmp, sbin, and so on.
We allocate about 25GB or more to the root partition, and then the rest of the space is allocated to the/home partition in the same way that the partition is added for storing our users ' files.
Then it's important to remember to select the device that installs the boot bootloader as the partition name that was previously assigned to/boot. As in, it is sdb2, but your situation may be another name:
End installation of Ubuntu
After completing the most arduous disk partitioning, the next steps are as simple as a quick walkthrough. Can have a cup of coffee, eat a roast chicken, slowly configure the installation:
Next, follow the prompts to select the time zone:
Small partners in the country to choose the Beijing time zone is good (time zone selection is not very important, casual selection), and then click "Continue", the next step:
Choose the keyboard layout, we choose Chinese, of course you can choose other languages:
Click Continue, Next:
Set user name, password, etc. Click "Continue" and the next step:
Start the installation, please wait patiently.
When the installation is complete, click Restart.
If the user is win 8 or win (Uefi as boot boot) , then reboot, enter the UEFI (BIOS), set Ubuntu as the first boot entry, save the exit.
Enter Ubuntu and the installation is complete.
If it is a win 7 users , if the reboot after the discovery of the boot option is not Ubuntu, but directly into the Windows system. At this time you eat half of the roast chicken will choke you ...
Then you need to add the boot boot entry in Windows, using software like EASYBCD.
modifying system startup Items with EASYBCD
After installing EASYBCD in Windows, click "Add New Entry" To select Linux/bsd: specific settings such as. Type Choose grub (Legacy); name is written casually, the small writing is Ubuntu as the logo; drive: Choose the/boot partition we have set, with the Linux tag. Click "Add Entry" when Setup is complete.
When the computer starts again, you can see more Ubuntu startup options (There is an Ubuntu Recovery mode, this is the Safe Mode/recovery mode that needs to be entered when Ubuntu startup is problematic in order to solve the problem. Generally do not enter this mode).
You can use the up and down keys on your keyboard to choose which system to enter: Windows or Ubuntu.
Recommended reference to the two Baidu experience of the graphic tutorial:
"Uefi win 8.1+ubuntu 14.04 installation Tutorial"
"Win7 USB flash drive Installation Ubuntu14.04 dual system steps detailed"
A long gulp of breath, finally ended. Linux is not easy to install, there are many concepts.
So, if it's not for Linux, it's not recommended to install a Linux system. Although the installation of Ubuntu system has become more and more simple, but for most users, it is quite cumbersome.
Usually, using Windows and Mac OS is enough. Or Bill Gates's windows most pro-people, play DotA and other games can only use Windows ...
This article wrote for more than 10 hours, for many years did not play DotA I would like to have a dota to relax a bit ~ unfortunately not installed ...
Different versions of Ubuntu can be installed on different operating systems, and it is not possible to do a small series of courses. This course demonstrates the process of installing Ubuntu 14.04 on Windows. If you are installing other versions of Ubuntu (such as 12.04,13.04,15.04) on other operating systems (such as Mac OS), please google and Baidu yourself. The general difference is not too large.
Most of the new boot programs, such as the Win 8,win 10 system, have become more powerful uefi from the traditional BIOS. So the process of installing Ubuntu is a little different from the one in Win XP and Win7.
A hard disk can be "virtualized" to separate parts, which is the main principle of disk partitioning.
In order to install the Linux system (we used the Ubuntu Linux distribution) to the hard disk, we need to partition the disk first. The disk space that was originally part of the Windows operating system to use for Ubuntu.
We have allocated a swap partition of the same size and memory, which can be used as virtual memory when the memory is running out.
We can use the Ubuntu system grub to boot Ubuntu and Windows boot, or you can use the Windows boot program to boot two systems. Recommend the boot program for Windows.
Today's class will come here, together refueling it!
Next lesson We study:Unity Desktop, if life is just like the first
Programmer Union Public Number
* If you think this article is good, please click on the top right corner of the screen "... "button to share
* New friends Please pay attention to "the Programmer Alliance" search public number Programmerleague
Programmer's Alliance website:
Small number: Frogoscar
Small e-mail: [Email protected]
QQ No.: 379641629
Programmer Alliance QQ Group: 413981577
Programmer Alliance Group: Add me first
Headline web from the Media " Programmer Alliance ":
Small 51CTO blog, csdn blog, blog Park, Sina blog and Open source China Blog
"Linux Discovery Tour" Part One lesson four: disk partitioning and completing Ubuntu installation
Start building with 50+ products and up to 12 months usage for Elastic Compute Service