个人工具

“UbuntuHelp:DiskSpace”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/DiskSpace}}
 
{{From|https://help.ubuntu.com/community/DiskSpace}}
 
{{Languages|UbuntuHelp:DiskSpace}}
 
{{Languages|UbuntuHelp:DiskSpace}}
 +
The goal of this page is to offer advice and strategy on partitioning a Linux system. 
 +
 +
=== Partitioning Strategies ===
 +
 +
==== Swap ====
 +
 +
Modern operating systems have virtual memory systems that allow the system to have more memory than the amount of RAM in the system (VM does many other things too).  The hard disk is used to realize this extra memory, known as ''swap''.  In Linux, it is possible to have a ''swap file'', ''swap partition'', a combination of either, or no swap at all.  Swap partitions are slightly faster than files, and are more traditional in a Linux system.  The advantage of swap files is that they can be created on the fly.
 +
 +
A good rule of thumb is to make your swap partition the size of your RAM.  If you need more memory than that, you are better off just buying more RAM.  Swap is much slower than RAM, and you ''will'' notice when the system starts dipping into swap when there is not enough RAM to satisfy the demand for memory.  Though it is slow, swap is still important, because the kernel puts data from RAM that is not being used at the moment so that RAM can be used for other things like disk caching.
 +
 +
Not all areas of a hard drive are equal.  Generally, the cylinders that are on the edge of the platter are faster than the ones near the spindle.  How to determine where the a given region is physically located on the platter is another matter.  In my experience, the beginning of the drive corresponds to the outer edge.  Thus it is probably best to put swap at the beginning of the drive.  Alternatively, it could be argued that placing swap in the middle will reduce seek times if the disk is seeking all over.  The only way to know is to try it in several places and do some benchmarking.  The best way is to realize that you will probably not notice the difference and not waste time and effort on such things.
 +
 +
If you have several physical disks, put a portion of swap on each.  The kernel will automatically use the different swap partitions in parallel, thus you will see a nearly linear increase in throughput performance.
 +
 +
==== Simple ====
 +
 +
The easiest partitioning scheme is simply a root partition and a swap partition. 
 +
 +
{|border="1" cellspacing="0"
 +
|'''Name'''||'''Size'''
 +
|-
 +
|`swap`||size of RAM
 +
|-
 +
|`/`||the rest of the disk
 +
|}
 +
 +
==== Separate /home ====
 +
 +
It is very prudent to put `/home` on it's own partition.  All of ''your'' data goes into `/home`.  You can be confident that your data will be safe even if you decide to reinstall the system, or install a new version of Ubuntu.  Also, you could use a VFAT filesystem in order to share your data between Ubuntu and Windows (it is not a good idea to use VFAT for the root filesystem).  It is generally better to make a separate VFAT partition and keep `/home` as Linux filesystem, since VFAT has trouble with large files, fragmentation, and permissions.  If you install another Linux along side Ubuntu, the `/home` partition can be shared amongst them.
 +
 +
{|border="1" cellspacing="0"
 +
|'''Name'''||'''Size'''
 +
|-
 +
|`swap`||size of RAM
 +
|-
 +
|`/`||at least 3GB, at most 15 GB
 +
|-
 +
|`/home`||the rest of the disk
 +
|}
 +
 +
==== Separate /boot ====
 +
 +
If you want to install more than one Linux distribution, it can be easier to make a dedicated `/boot` partition.  That way, all of the data needed to boot the system will be on one partition, and you will have to jump through fewer hoops when configuring the bootloader (GrubHowTo).  As of 7.04, a kernel image is about 15-20 MB, and you need enough space for about 3 of them (current, old, and space for a new one).
 +
 +
{|border="1" cellspacing="0"
 +
|'''Name'''||'''Size'''
 +
|-
 +
|`swap`||size of RAM
 +
|-
 +
|`/`||at least 3GB, at most 15 GB
 +
|-
 +
|`/boot`||at least 100 MB, at most 250 MB
 +
|-
 +
|`/home`||the rest of the disk
 +
|}
 +
 +
==== More Complex Schemes ====
 +
 +
''Work in progress.''
 +
 +
=== Space Requirements ===
 +
 +
''This information was taken from [[UbuntuHelp:forum/installation/DiskSpace]].  The original article was last edited on 2006-05-28, thus it is probably out of date and should be verified.''
 +
 +
==== Absolute Requirements ====
 +
 +
The required disk space for an out-of-the-box Ubuntu installation is said to be 1.8 GB.  However, that does not take into account the space needed for a filesystem or a swap partition.
 +
 +
It is more realistic to give yourself a little bit more than 2.2 GB of space.  Give yourself 3 GB to have some space left for actually doing things.  If your filesystem is full to the brim, you will feel some performance loss. 
 +
 +
A certain percentage of an ext3 filesystem is dedicated to root, as a way of preventing a rogue process from filling the disk to the point that the system is unusable.  This dedicated portion is 5% by default.  Also, the anti-fragmentation strategies used by Linux filesystems require that the disk is not nearly full.  A rule of thumb is to keep them less than 90% full.
 +
 +
==== Installation on a small disk ====
 +
 +
During a normal install, the installer copies the packages from the CD to the hard drive (in addition to actually installing them).  If you are short on disk space before you install, you can tell the installer not to use extra disk space.  The packages take up about 300 MB.  You will be able to install a full Ubuntu system with less than 1.8 gigs of hard drive space.
 +
 +
At the installation prompt (just after you boot from cd) type:
 +
 +
<pre><nowiki>
 +
linux archive-copier/copy=false
 +
</nowiki></pre>
 +
 +
----
 +
[[category:CategoryDocumentation]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2007年11月22日 (四) 12:23的版本


The goal of this page is to offer advice and strategy on partitioning a Linux system.

Partitioning Strategies

Swap

Modern operating systems have virtual memory systems that allow the system to have more memory than the amount of RAM in the system (VM does many other things too). The hard disk is used to realize this extra memory, known as swap. In Linux, it is possible to have a swap file, swap partition, a combination of either, or no swap at all. Swap partitions are slightly faster than files, and are more traditional in a Linux system. The advantage of swap files is that they can be created on the fly.

A good rule of thumb is to make your swap partition the size of your RAM. If you need more memory than that, you are better off just buying more RAM. Swap is much slower than RAM, and you will notice when the system starts dipping into swap when there is not enough RAM to satisfy the demand for memory. Though it is slow, swap is still important, because the kernel puts data from RAM that is not being used at the moment so that RAM can be used for other things like disk caching.

Not all areas of a hard drive are equal. Generally, the cylinders that are on the edge of the platter are faster than the ones near the spindle. How to determine where the a given region is physically located on the platter is another matter. In my experience, the beginning of the drive corresponds to the outer edge. Thus it is probably best to put swap at the beginning of the drive. Alternatively, it could be argued that placing swap in the middle will reduce seek times if the disk is seeking all over. The only way to know is to try it in several places and do some benchmarking. The best way is to realize that you will probably not notice the difference and not waste time and effort on such things.

If you have several physical disks, put a portion of swap on each. The kernel will automatically use the different swap partitions in parallel, thus you will see a nearly linear increase in throughput performance.

Simple

The easiest partitioning scheme is simply a root partition and a swap partition.

Name Size
`swap` size of RAM
`/` the rest of the disk

Separate /home

It is very prudent to put `/home` on it's own partition. All of your data goes into `/home`. You can be confident that your data will be safe even if you decide to reinstall the system, or install a new version of Ubuntu. Also, you could use a VFAT filesystem in order to share your data between Ubuntu and Windows (it is not a good idea to use VFAT for the root filesystem). It is generally better to make a separate VFAT partition and keep `/home` as Linux filesystem, since VFAT has trouble with large files, fragmentation, and permissions. If you install another Linux along side Ubuntu, the `/home` partition can be shared amongst them.

Name Size
`swap` size of RAM
`/` at least 3GB, at most 15 GB
`/home` the rest of the disk

Separate /boot

If you want to install more than one Linux distribution, it can be easier to make a dedicated `/boot` partition. That way, all of the data needed to boot the system will be on one partition, and you will have to jump through fewer hoops when configuring the bootloader (GrubHowTo). As of 7.04, a kernel image is about 15-20 MB, and you need enough space for about 3 of them (current, old, and space for a new one).

Name Size
`swap` size of RAM
`/` at least 3GB, at most 15 GB
`/boot` at least 100 MB, at most 250 MB
`/home` the rest of the disk

More Complex Schemes

Work in progress.

Space Requirements

This information was taken from UbuntuHelp:forum/installation/DiskSpace. The original article was last edited on 2006-05-28, thus it is probably out of date and should be verified.

Absolute Requirements

The required disk space for an out-of-the-box Ubuntu installation is said to be 1.8 GB. However, that does not take into account the space needed for a filesystem or a swap partition.

It is more realistic to give yourself a little bit more than 2.2 GB of space. Give yourself 3 GB to have some space left for actually doing things. If your filesystem is full to the brim, you will feel some performance loss.

A certain percentage of an ext3 filesystem is dedicated to root, as a way of preventing a rogue process from filling the disk to the point that the system is unusable. This dedicated portion is 5% by default. Also, the anti-fragmentation strategies used by Linux filesystems require that the disk is not nearly full. A rule of thumb is to keep them less than 90% full.

Installation on a small disk

During a normal install, the installer copies the packages from the CD to the hard drive (in addition to actually installing them). If you are short on disk space before you install, you can tell the installer not to use extra disk space. The packages take up about 300 MB. You will be able to install a full Ubuntu system with less than 1.8 gigs of hard drive space.

At the installation prompt (just after you boot from cd) type:

linux archive-copier/copy=false