multiple disks, multiple partitions, multiple OS
1. 基本知识一块硬盘可以有1-3个主分区和1个扩展分区,或者1-4个主分区。一个扩展分区可以分为若干个逻辑分区。
硬盘的容量=主分区的容量+扩展分区的容量
扩展分区的容量=各个逻辑分区的容量之和
通常,在PC机上使用的硬盘有两种:
1) IDE接口:最常见的;
2) SCSI接口:比IDE性能好,但更贵!
操作系统对分区的要求。
Windows必须安装在主分区上。磁盘格式为FAT32/NTFS
Solaris(Unix)必须安装在主分区上。磁盘格式为Solaris
Ubuntu(Linux)可以安装在逻辑分区上。磁盘格式为Ext3/swap
2. Windows
Partition Diagrams
http://www.agoit.com/upload/attachment/83039/98e3f742-fdbd-3064-8d8e-35bd0068eb8a.jpg
http://www.agoit.com/upload/attachment/83045/9864b0b0-e23d-30b1-893b-f627b1687a9e.jpg
3. Linux(Ubuntu)
Linux下的磁盘设备
IDE设备:一台PC上可以有两个IDE接口(我将其称为第一IDE、第二IDE),而每个IDE接口上可以接两个IDE设备(我将其称为主盘、从盘)。其中硬盘与光驱都是IDE设备。Linux这样为其命名:
第一IDE的主盘:/dev/hda
第一IDE的从盘:/dev/hdb
第二IDE的主盘:/dev/hdc
第二IDE的从盘:/dev/hdd
SCSI设备:这个相对大家会陌生一些,它通常需要加上一块SCSI卡来驱动。
第一块SCSI设备称为:/dev/sda
第二块SCSI设备称为:/dev/sdb……
以此类推。
Linux下的分区命名
也就是主分区(或扩展分区)被命名为hda1-hda4,如果没有,就跳过。而扩展分区中的逻辑分区则从hda5开始编号,以此类推。 这里是以第一IDE的主盘为例,如果是第二硬盘,就是hdb1、hdb2、hdb5、hdb6、hdb7。
Command - View Disks
robert@laptop-ubuntu:~$ sudo fdisk -l
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x18bc18bc
Device Boot Start End Blocks Id System
/dev/sda1 * 1 5838 46886912 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2 5838 6360 4195328 c W95 FAT32 (LBA)
Partition 2 does not end on cylinder boundary.
/dev/sda3 6360 8971 20971096 bf Solaris
/dev/sda4 8972 14593 45158715 f W95 Ext'd (LBA)
/dev/sda5 11582 14593 24191968+ 7 HPFS/NTFS
/dev/sda6 8972 11087 16996707 83 Linux
/dev/sda7 11088 11581 3968023+ 82 Linux swap / Solaris
Partition table entries are not in disk order
Disk /dev/sdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe6e9f997
Device Boot Start End Blocks Id System
/dev/sdb1 1 4177 33551721 c W95 FAT32 (LBA)
/dev/sdb2 4178 8354 33551752+ 7 HPFS/NTFS
/dev/sdb3 8355 9729 11044687+ c W95 FAT32 (LBA)
Command - View one Disk
robert@laptop-ubuntu:~$ sudo fdisk -l /dev/sda
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x18bc18bc
Device Boot Start End Blocks Id System
/dev/sda1 * 1 5838 46886912 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2 5838 6360 4195328 c W95 FAT32 (LBA)
Partition 2 does not end on cylinder boundary.
/dev/sda3 6360 8971 20971096 bf Solaris
/dev/sda4 8972 14593 45158715 f W95 Ext'd (LBA)
/dev/sda5 11582 14593 24191968+ 7 HPFS/NTFS
/dev/sda6 8972 11087 16996707 83 Linux
/dev/sda7 11088 11581 3968023+ 82 Linux swap / Solaris
Partition table entries are not in disk order
Command - Disk Usage
robert@laptop-ubuntu:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda6 16729812 13400616 2479364 85% /
tmpfs 1023600 0 1023600 0% /lib/init/rw
varrun 1023600 120 1023480 1% /var/run
varlock 1023600 0 1023600 0% /var/lock
udev 1023600 2872 1020728 1% /dev
tmpfs 1023600 104 1023496 1% /dev/shm
lrm 1023600 2004 1021596 1% /lib/modules/2.6.27-11-generic/volatile
/dev/sdb1 33535328 99216 33436112 1% /media/Work
/dev/sdb3 11033888 7937768 3096120 72% /media/Buffer
/dev/sdb2 33551752 23135812 10415940 69% /media/Backup
Mount Disks
mount ntfs, the permission is 777, however, mountfat it is 755, in addition, you can't change the permission and owner.
mount -t ntfs /dev/sda5 /media/Work
mount -t vfat /dev/sdb1 /media/Work
If you want any user to access the partition, please use the /etc/fstab to mount the disks as follows,
Add the lines to /etc/fstab,
/dev/sdb1 /media/Work vfat iocharset=utf8,umask=000 0 0
/dev/sdb2 /media/Backup ntfs iocharset=utf8,umask=000 0 0
/dev/sdb3 /media/Buffer vfat iocharset=utf8,umask=000 0 0
页:
[1]