|
<< Return to table of contents
In this guide, we are going to set up the partitions in a simple
fashion- nothing fancy. We want to end up with 3 hard disk partitions.
In general terms, there will be 1 partition for the Linux operating
system files, 1 for the virtual memory swap space, and 1 for all of the
user data we plan to store on the Kuro Box.
| Our planned hard disk
layout |
| /dev/hda1 |
/ |
ext3 |
10 GB |
Linux Boot and OS |
| /dev/hda2 |
|
swap |
512 MB |
Virtual memory |
| /dev/hda3 |
/datafiles |
ext3 |
All Remaining |
User files (samba shares, etc.) |
Now we are ready to partition the drive with fdisk:
EM mode shell for root |
| # fdisk
/dev/hda |
The number of cylinders for this disk is set to 30515.
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)
|
|
Command (m for help): |
| Notes: |
We will take a minute to learn about fdisk and what options it has.
Enter an "m" at the prompt:
Learning fdisk |
|
Command (m for help): m |
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only) |
|
Command (m for help): p |
Disk /dev/hda: 251.0 GB,
251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System |
|
Command (m for help): |
| Notes: |
As you can see, my disk is empty. If your disk contains any
partitions, you should delete them using the "d" option. THIS WILL ERASE
ANY DATA ON YOUR HARD DISK!
I will create the first partition:
Create 1st partition |
|
Command (m for help): n |
Command action
e extended
p primary partition (1-4) |
| p |
|
Partition number (1-4): 1 |
|
First cylinder (1-30515, default 1): <enter> |
| Using default value 1 |
|
Last cylinder or +size or +sizeM or +sizeK (1-30515, default
30515): +10240M |
| Notes: We took the default value of 1
for 1st cylinder and told it we wanted a 10 GB size. |
Ok, now, the swap on hda2:
Create 2nd partition for swap |
|
Command (m for help): n |
Command action
e extended
p primary partition (1-4) |
| p |
|
Partition number (1-4): 2 |
|
First cylinder (1247-30515, default 1247): <enter> |
| Using default value 1247 |
|
Last cylinder or +size or +sizeM or +sizeK (1247-30515, default
30515): +512M |
|
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) |
| Notes: We took the default value for
the 1st cylinder and told it we wanted a 512 MB size. |
And finally, we create the 3rd partition and tell it to take all
remaining space on the drive:
Create 3rd partition |
|
Command (m for help): n |
Command action
e extended
p primary partition (1-4) |
| p |
|
Partition number (1-4): 3 |
|
First cylinder (1310-30515, default 1310): <enter> |
| Using default value 1310 |
|
Last cylinder or +size or +sizeM or +sizeK (1310-30515, default
30515): <enter> |
| Notes: We took the default value for
both 1st and last cylinder. |
Lets check that the resulting partition table is what we were
expecting:
Check the results |
|
Command (m for help): p |
Disk /dev/hda: 251.0 GB,
251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start
End Blocks
Id System
/dev/hda1
1 1246 10008463+
83 Linux
/dev/hda2
1247 1309
506047+ 82 Linux swap
/dev/hda3
1310 30515 224588700
83 Linux |
|
Command (m for help): |
| Notes: |
The results look good so we will write our changes to disk:
Write the changes to disk |
|
Command (m for help): w |
The partition table has been
altered!
Calling ioctl() to re-read partition table.
Syncing disks.
|
| # |
| Notes: |
Now we are ready to move on.
We will use the ext3 file system for all partitions. With additional
kernel modules, it is possible to use other filesystems like reiserfs
(except for the root partition), but I think using ext3 is really the
safest solution.
The command to format with ext3 is "mke2fs -j /dev/hdaX" (where X is
the partition number).
Format partition 1:
Format partition 1 |
| # mke2fs
-j /dev/hda1 |
mke2fs 1.22, 22-Jun-2001 for EXT2 FS
0.5b, 95/08/09
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1251712 inodes, 2502115 blocks
125105 blocks (5.00%) reserved for the super user
First data block=0
77 block groups
32768 blocks per group, 32768 fragments per group
16256 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to
override. |
| Notes: |
Format partition 2 as a Linux swap volume:
Format partition 2 as a Linux swap volume |
| # mkswap
/dev/hda2 |
| Setting up swapspace version 1, size
= 518184960 bytes |
| Notes: |
Format partition 3:
Format partition 3 |
| # mke2fs
-j /dev/hda3 |
mke2fs 1.22, 22-Jun-2001 for EXT2 FS
0.5b, 95/08/09
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
24330240 inodes, 48644812 blocks
2432240 blocks (5.00%) reserved for the super user
First data block=0
1485 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632,
2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to
override. |
| Notes: |
OK, now we are ready to move on.
<< Return to table of contents |