日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > 服務器 > Linux操作系統系列之磁盤分區知識

Linux操作系統系列之磁盤分區知識

來源:程序員人生   發布時間:2013-10-16 21:26:56 閱讀次數:2639次

每塊硬盤的 MBR 最多只能存儲 4 個分區信息,也就是說每塊物理硬盤我們最多分成4個主分區(P + P + P + P),或者3個主分區外加一個擴展分區(P + P + P + E)。如果我們希望劃分更多的分區,可以將擴展分區劃分更多更小的邏輯分區。

Linux 將編號 1 ~ 4 固定分配給 4 個主要分區。也就是說即便我們只有 1 個主分區和 1 個擴展分區,那第一個邏輯分區也只能是 hda5 (或 sda5)。

uploads/view/_185916_1.png

談論 Linux 分區時和 Windows 有很大的不同,因為這些分區通常以某個目錄方式存在 (或者說掛載點)。
/: 默認掛載點,未指定的目錄都將存放在分區中。
/home: 用戶主目錄,相當于 Windows 的 Documents and Settings,存放各用戶的相關數據文件,適合單獨分區。
/usr: 各種執行程序安裝目錄,相當于 Windows 的 Program files 和 Winnt 目錄。建議單獨分區。
/var: 通常用于存放各種臨時文件和緩存文件,容易產生磁盤碎片,建議單獨分區。
當然,別忘了充當虛擬內存 swap 分區。

以下是我個人習慣的分區方式。

uploads/view/_185920_2.png

/: 1GB ~ 2GB。
/usr: 1GB ~ 2GB,依據需要安裝的服務和軟件而定。
swap: 通常是物理內存的 2 倍,但似乎沒必要超過 1GB。
/home: 所有剩余空間
/var: 1GB 左右
我們用 Fdisk 對一個 8GB 的硬盤做一個分區演示。

yuhen@yuhen-desktop:~$ sudo fdisk /dev/sdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x416ba19a.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

The number of cylinders for this disk is set to 1044.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p # 查看分區信息

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x416ba19a

Device Boot Start End Blocks Id System

Command (m for help): n # 新建主分區 /
Command action
e extended
p primary partition (1-4)
p # 新建主分區
Partition number (1-4): 1 # 分區編號
First cylinder (1-1044, default 1): # 開始柱面,通常用默認值
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1044, default 1044): +1024M # 分區大小 1GB。

Command (m for help): n # 新建主分區 /usr
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (133-1044, default 133):
Using default value 133
Last cylinder, +cylinders or +size{K,M,G} (133-1044, default 1044): +1024M

Command (m for help): n # 新建主分區 swap
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (265-1044, default 265):
Using default value 265
Last cylinder, +cylinders or +size{K,M,G} (265-1044, default 1044): +512M

Command (m for help): n # 新建擴展分區
Command action
e extended
p primary partition (1-4)
e
Selected partition 4
First cylinder (331-1044, default 331):
Using default value 331
Last cylinder, +cylinders or +size{K,M,G} (331-1044, default 1044): # 全部剩余空間
Using default value 1044

Command (m for help): p # 查看分區

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x416ba19a

Device Boot Start End Blocks Id System
/dev/sdb1 1 132 1060258+ 83 Linux
/dev/sdb2 133 264 1060290 83 Linux
/dev/sdb3 265 330 530145 83 Linux
/dev/sdb4 331 1044 5735205 5 Extended

Command (m for help):

至此我們完成了 4 個主分區的劃分,接下來為創建邏輯分區。

Command (m for help): n # 創建 /home 邏輯分區
First cylinder (331-1044, default 331):
Using default value 331
Last cylinder, +cylinders or +size{K,M,G} (331-1044, default 1044): +4096M

Command (m for help): n # 創建 /var 邏輯分區
First cylinder (854-1044, default 854):
Using default value 854
Last cylinder, +cylinders or +size{K,M,G} (854-1044, default 1044):
Using default value 1044

Command (m for help): p # 顯示分區

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe1bd2899

Device Boot Start End Blocks Id System
/dev/sdb1 1 132 1060258+ 83 Linux
/dev/sdb2 133 264 1060290 83 Linux
/dev/sdb3 265 330 530145 83 Linux
/dev/sdb4 331 1044 5735205 5 Extended
/dev/sdb5 331 853 4200966 83 Linux
/dev/sdb6 854 1044 1534176 83 Linux

Command (m for help):

別忘了保存分區表,否則上面的工作就白做了。

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

看看效果。

yuhen@yuhen-desktop:~$ sudo fdisk -l /dev/sdb

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x71f06c9b

Device Boot Start End Blocks Id System
/dev/sdb1 1 132 1060258+ 83 Linux
/dev/sdb2 133 264 1060290 83 Linux
/dev/sdb3 265 330 530145 83 Linux
/dev/sdb4 331 1044 5735205 5 Extended
/dev/sdb5 331 853 4200966 83 Linux
/dev/sdb6 854 1044 1534176 83 Linux

接下來就是格式化分區了。

yuhen@yuhen-desktop:~$ sudo mke2fs -j -L "root" /dev/sdb1
mke2fs 1.41.4 (27-Jan-2009)
Filesystem label=root
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
66384 inodes, 265064 blocks
13253 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=272629760
9 block groups
32768 blocks per group, 32768 fragments per group
7376 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

給分區設置一個 Label,便于以后管理。

有關分區掛載點,可查看后續章節。

--------------------- 分割線 ----------------------

上圖是我在 VMware 上安裝 Ubuntu Desktop 9.04 時的分區設置,由于 Desktop 默認集成了一些軟件,因此對 "/" 和 "/usr" 有最小尺寸限制。

網(liehuo.net)提示:點擊新窗口預覽!

生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 日韩av手机在线观看 | 久久久久一区二区 | 91麻豆精品国产91久久久久久 | 色综合九九| 婷婷五月在线视频 | 国产精品免费网站 | 久久av福利 | 狠狠久久 | 播五月婷婷| 午夜视频免费看 | 久久新| 欧美国产日韩精品 | av在线不卡网站 | 精品一区视频 | av网站入口| 亚洲成人精品一区二区 | 国产成人精品在线 | 黄色大片免费观看 | 日韩一级黄色片 | 亚洲国产成人在线 | 欧美午夜精品一区二区三区电影 | 国产h片在线观看 | 亚洲精品av在线 | 久久骚 | 亚洲精品久久久久久久久久久久久久 | 在线亚洲电影 | 人人九九精品 | 国产欧美日韩综合 | 亚洲乱码国产乱码精品精 | 国产精品尤物视频 | 国产精品视频久久久 | 亚洲一区二区精品视频 | 91久久国产综合久久91精品网站 | 九九热在线视频观看这里只有精品 | 国产一区精品在线 | 国产精品视频一二三区 | 久久高清精品 | 牛牛av| 国产一区二区三区在线视频 | 婷婷毛片 | 国产一区不卡 |