国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
Partitioning with fdisk

5. Partitioning with fdisk

This section shows you how to actually partition your hard drive withthe fdisk utility. Linux allows only 4 primarypartitions. You can have a much larger number of logical partitions bysub-dividing one of the primary partitions. Only one of the primarypartitions can be sub-divided.

Examples:

 

  1. Four primary partitions (see Section 5.2)

  2. Mixed primary and logical partitions (see Section 5.3)

 

fdisk is started by typing (as root)fdiskdevice at the command prompt.device might be something like /dev/hda or /dev/sda (see Section 2.1.1). The basicfdisk commands you need are:

pprint the partition table

ncreate a new partition

ddelete a partition

qquit without saving changes

wwrite the new partition table and exit

 

Changes you make to the partition table do not take effect until you issue the write (w) command.Here is a sample partition table:

Disk /dev/hdb: 64 heads, 63 sectors, 621 cylinders            Units = cylinders of 4032 * 512 bytes            Device Boot    Start       End    Blocks   Id  System            /dev/hdb1   *         1       184    370912+  83  Linux            /dev/hdb2           185       368    370944   83  Linux            /dev/hdb3           369       552    370944   83  Linux            /dev/hdb4           553       621    139104   82  Linux swap            
The first line shows the geometry of your hard drive. It may not bephysically accurate, but you can accept it as though it were. The harddrive in this example is made of 32 double-sided platters with onehead on each side (probably not true). Each platter has 621 concentrictracks. A 3-dimensional track (the same track on all disks) is calleda cylinder. Each track is divided into 63 sectors. Each sectorcontains 512 bytes of data. Therefore the block size in the partitiontable is 64 heads * 63 sectors * 512 bytes er...divided by 1024. (See4 for discussion onproblems with this calculation.) The start and end values are cylinders.

The overview:

Decide on the size of your swap space (see Section 4.4) and where it ought to go (see Section 4.4.3).Divide up the remaining space for the three other partitions.

Example:

I start fdisk from the shell prompt:

# fdisk /dev/hdb            
which indicates that I am using the second drive on my IDE controller.(See Section 2.1.) When I print the (empty) partition table,I just get configuration information.
Command (m for help): p            Disk /dev/hdb: 64 heads, 63 sectors, 621 cylinders            Units = cylinders of 4032 * 512 bytes            
I knew that I had a 1.2Gb drive, but now I really know: 64 * 63 * 512* 621 = 1281982464 bytes. I decide to reserve 128Mb of that space forswap, leaving 1153982464. If I use one of my primary partitions forswap, that means I have three left for ext2 partitions. Dividedequally, that makes for 384Mb per partition. Now I get to work.
            Command (m for help): n            Command action            e   extended            p   primary partition (1-4)            p            Partition number (1-4): 1            First cylinder (1-621, default 1):<RETURN>            Using default value 1            Last cylinder or +size or +sizeM or +sizeK (1-621, default 621): +384M            
Next, I set up the partition I want to use for swap:
Command (m for help): n            Command action            e   extended            p   primary partition (1-4)            p            Partition number (1-4): 2            First cylinder (197-621, default 197):<RETURN>            Using default value 197            Last cylinder or +size or +sizeM or +sizeK (197-621, default 621): +128M            
Now the partition table looks like this:
   Device Boot    Start       End    Blocks   Id  System            /dev/hdb1             1       196    395104   83  Linux            /dev/hdb2           197       262    133056   83  Linux            
I set up the remaining two partitions the same way I did the first.Finally, I make the first partition bootable:
Command (m for help): a            Partition number (1-4): 1            
And I make the second partition of type swap:
Command (m for help): t            Partition number (1-4): 2            Hex code (type L to list codes): 82            Changed system type of partition 2 to 82 (Linux swap)            Command (m for help): p            
The end result:
Disk /dev/hdb: 64 heads, 63 sectors, 621 cylinders            Units = cylinders of 4032 * 512 bytes            Device Boot    Start       End    Blocks   Id  System            /dev/hdb1   *         1       196    395104+  83  Linux            /dev/hdb2           197       262    133056   82  Linux swap            /dev/hdb3           263       458    395136   83  Linux            /dev/hdb4           459       621    328608   83  Linux            
Finally, I issue the write command (w) to write the table on the disk.

Side topics:

 

 

5.3. Mixed primary and logical partitions

The overview: create one use one of the primarypartitions to house all the extra partitions. Then create logicalpartitions within it. Create the other primary partitions before orafter creating the logical partitions.

Example:

I start fdisk from the shell prompt:

# fdisk /dev/sda            
which indicates that I am using the first drive on my SCSI chain.(See Section 2.1.)

First I figure out how many partitions I want. I know my drive has a183Gb capacity and I want 26Gb partitions (because I happen to haveback-up tapes that are about that size).

183Gb / 26Gb = ~7

so I will need 7 partitions. Even though fdisk accepts partition sizesexpressed in Mb and Kb, I decide to calculate the number of cylindersthat will end up in each partition because fdisk reports start andstop points in cylinders. I see when I enter fdisk that I have 22800cylinders.

> The number of cylinders for this disk is set to 22800.  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., LILO) 2) booting and partitioning software from other            > OSs  (e.g., DOS FDISK, OS/2 FDISK)            
So, 22800 total cylinders divided by seven partitions is 3258cylinders. Each partition will be about 3258 cylinders long. I ignorethe warning msg because this is not my boot drive (Section 4).

Since I have 4 primary partitions, 3 of them can be 3258long. The extended partition will have to be (4 * 3258), or 13032,cylinders long in order to contain the 4 logical partitions.

I enter the following commands to set up the first of the 3 primarypartitions (stuff I type is bold ):

            Command (m for help): n            Command action            e   extended            p   primary partition (1-4)            p            Partition number (1-4): 1            First cylinder (1-22800, default 1): <RETURN>            Using default value 1            Last cylinder or +size or +sizeM or +sizeK (1-22800, default 22800): 3258            
The last partition is the extended partition:
Partition number (1-4): 4            First cylinder (9775-22800, default 9775): <RETURN>            Using default value 9775            Last cylinder or +size or +sizeM or +sizeK (9775-22800, default 22800): <RETURN>            Using default value 22800            
The result, when I issue the print table command is:
/dev/sda1             1      3258  26169853+  83  Linux            /dev/sda2          3259      6516  26169885   83  Linux            /dev/sda3          6517      9774  26169885   83  Linux            /dev/sda4          9775     22800 104631345    5  Extended            
Next I segment the extended partition into 4 logical partitions,starting with the first logical partition, into 3258-cylindersegments. The logical partitions automatically start from /dev/sda5.
Command (m for help):  n            First cylinder (9775-22800, default 9775): <RETURN>            Using default value 9775            Last cylinder or +size or +sizeM or +sizeK (9775-22800, default 22800): 13032            
The end result is:
   Device Boot    Start       End    Blocks   Id  System            /dev/sda1             1      3258  26169853+  83  Linux            /dev/sda2          3259      6516  26169885   83  Linux            /dev/sda3          6517      9774  26169885   83  Linux            /dev/sda4          9775     22800 104631345    5  Extended            /dev/sda5          9775     13032  26169853+  83  Linux            /dev/sda6         13033     16290  26169853+  83  Linux            /dev/sda7         16291     19584  26459023+  83  Linux            /dev/sda8         19585     22800  25832488+  83  Linux            
Finally, I issue the write command (w) to write the table on the disk.To make the partitions usable, I will have to format (Section 10.1)each partition and then mount (Section 10.3) it.

5.4. Submitted Examples

I'd like to submit my partition layout, because it works well withany distribution of Linux (even big RPM based ones).I have one hard drive that ... is 10 gigs, exactly. Windowscan't see above 9.3 gigs of it, but Linux can see it all, and use itall. It also has much more than 1024 cylenders.

Table 7. Partition layout example

PartitionMount pointSize
/dev/hda1 /boot (15 megs)
/dev/hda2 windows 98 partition (2 gigs)
/dev/hda3 extended (N/A)
/dev/hda5 swap space (64 megs)
/dev/hda6 /tmp (50 megs)
/dev/hda7 / (150 megs)
/dev/hda8 /usr (1.5 gigs)
/dev/hda9 /home (rest of drive)
I test new kernels for the USB mass storage, so that explains the large/boot partition. I install LILO into the MBR, and by default I bootwindows (I'm not the only one to use this computer).

 

I also noticed that you don't have any REAL examples of partitiontables, and for newbies I HIGHLY suggest putting quite a few up. I'mfreshly out of the newbie stage, and partitioning was what messed me upthe most.

Valkor

本站僅提供存儲服務,所有內容均由用戶發(fā)布,如發(fā)現有害或侵權內容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
linux下使用fdisk結合partprobe命令不重啟系統(tǒng)添加一塊新的磁盤分區(qū)
Linux添加新硬盤、分區(qū)、格式化、自動掛載
Linux下硬盤分區(qū)詳解
linux掛載新硬盤,開機自動掛載
Linux使用fdisk進行磁盤管理 -- 之一
linux下掛載新的虛擬磁盤
更多類似文章 >>
生活服務
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯系客服!

聯系客服