Tutorial: Adding Additional Hard Drives in Linux - page 3
The Theory Behind Hard Drive Management
Let's try to add an absolutely new hard drive in this next example.
The only difference from the previous methodology is that before mounting the new drive, we need to divide that hard drive into partitions first and format them to whatever filesystem we want to use.
To keep things simple, we'll assume that this new hard drive is connected as the Master at the Secondary interface (hdc), just as in the prior example.
Dividing into partitions is done with the help of 'fdisk' utility:
# fdisk /dev/hdc Command (m for help): _
For a short manual we need to enter the 'm' command:
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):
We need to know just few necessary commands: d,p,n,q,w. Don't be afraid to use them--all your changes will be done only in memory and will only be written to the hard after the 'w' command is entered. If we have an error, we just need to cancel all changes with the command 'q'.
First of all, let's make ourself sure that disk is empty:
Command (m for help): p Disk /dev/hdc: 64 heads, 63 sectors, 787 cylinders Units = cylinders of 4032 * 512 bytes Device Boot Start End Blocks Id System Command (m for help):
Often sellers of PCs and hardware will pre-divide disks into partitions. In such cases we can use command 'd' (described below) to delete everything what we do not need.
So, let's create a new parititon (with command 'n'), answering all the questions as we go:
Command (m for help): n Command action e extended p primary partition (1-4)
Choosing the partition type-- primary or extended--we will enter P for primary.
In choosing number of the partition in this example, we will assign all of the all free space to one partition. Because this will be the first and only existing partition, we will assign the number 1:
Partition number (1-4): 1
When setting the number of the first cylinder of the partition, we can just use the default value, which is recorded when we just press Enter:
First cylinder (1-787, default 1): Using default value 1
Setting the number of the last cylinder of the partition is easy in this example, since we are filling the entire drive with one partition. Again, just press Enter for the default (instead of the number of the cylinder, we can set size of partition in bytes, kbytes, or megabytes):
Last cylinder or +size or +sizeM or +sizeK (1-787, default 787): Using default value 787 Command (m for help):
Now, partition is created. We can take a look of new table of partitions with the help of the 'p' command:
Command (m for help): p Disk /dev/hdc: 64 heads, 63 sectors, 787 cylinders Units = cylinders of 4032 * 512 bytes Device Boot Start End Blocks Id System /dev/hdc1 1 787 1586560+ 83 Linux Command (m for help):
If we don't like (for some reason) the location or number of the partition, we can delete it using 'd' command:
Command (m for help): d Partition number (1-4): 1 Command (m for help):
If you want to divide the disk into a few partitions, you will need to repeat all these operations a few times. One thing that is important to remember is that if the amount of partitions is greater than four, you'll need to create not primary, but an extended partition across the whole available disk space. Inside this partition you can create as many logical parts as needed.
Remember, please, that logical partitions always should be numbered from 5 upwards; it doesn't matter how many primary partitions were created before (one, three, or none at all).
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 3Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 4Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 5Linux Top 3: Debian Gives Up on Upstart, Ubuntu and Linux Kernel Updates