Results 1 to 1 of 1
Enjoy an ad free experience by logging in. Not a member yet? Register.
Attaching new harddisk to your system mini-howto
Please do NOT reply to this thread to ask a technical question. Replies to THIS thread should be corrections and enhancements on the tutorial/howto only.
Thanks in advance for your co-operation.
For this small tutorial we assume the following.
You have a system with one harddisk in it and as primary OS: Linux.
As this is a 10GB drive and you are running low on diskspace you buy a new, bigger and better one. Instead of replaceing the old one, you want to create several partitions on your new harddrive and mount them on boot time.
(Your CD/DVD is installed as primay on your second IDE controlere and therefore known as : /dev/hdc)
Your primary harddisk is known to linux as /dev/hda
You install you new HD in you machine and connet the cables.
Since it will be a slave to the primary disk it will be known as /dev/hdb
You'll notice that during bootup linux will see the new harddisk and show some information about it:
Here is an example from dmesg:
hda: ST38410A, ATA DISK drive blk: queue c0402f40, I/O limit 4095Mb (mask 0xffffffff) hdb: ST38410A, ATA DISK drive blk: queue c0402f40, I/O limit 4095Mb (mask 0xffffffff) hdc: SAMSUNG DVD-ROM SD-616F, ATAPI CD/DVD-ROM drive hdd: R/RW 4x4x32, ATAPI CD/DVD-ROM drive ide0 at 0x1f0-0x1f7,0x3f6 on irq 14 ide1 at 0x170-0x177,0x376 on irq 15 hda: attached ide-disk driver. hda: host protected area => 1 hda: 16841664 sectors (8623 MB) w/512KiB Cache, CHS=1048/255/63, UDMA(33) Partition check: hda: hda1 hda2 hdb: attached ide-disk driver. hdb: host protected area => 1 hdb: 16841664 sectors (8623 MB) w/512KiB Cache, CHS=1048/255/63, UDMA(33) Partition check: <none> ide: late registration of driver.
When booting into text mode, log as root.
Type: fdisk /dev/hdb
[root@garfield root]# fdisk /dev/hdb
The number of cylinders for this disk is set to 1048.
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):
Our HD is for this example 30GB and we want to create 3 partitions of 10GB each.
Press n to create a new partition,
select if you want to create a primary or extended partition.
For this example we'll now create a primay partition.
Press P to create a primay partition
select the partition number 1 - 4
Select the starting cylinders, usualy : 1
type +10000M to select the ending of the first partition at 10GB.
Command (m for help): n
p primary partition (1-4)
Partition number (1-4): 1
First cylinder (1-1868, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1868, default 186: +10000M
Command (m for help): p
Disk /dev/hdb: 15.3 GB, 15367790592 bytes
255 heads, 63 sectors/track, 1868 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 1 1217 9775521 83 Linux
Command (m for help):
To create the second press n again, select primary.
Default the starting cylinder is the previous ending +1,
If the previous partition ended at block 1217 the new one will start at 1218.
For the last cylinder of type: +10000M again.
This will create the second 10GB partition.
Type p to verifiy and view the partition table.
Now do the same for partition 3.
Now we're done, but still need to write the new partition table to disk,
this is done by pressing: w
You'll return to the root prompt when the new partition table information is written to disk.
Reboot the system and login again as user root or as yourself and su - to user root.
Now it's time to format the partitions and select a future mounting position.
We can choose from various filesystems.
EXT2 is the old one, but we want the journaling version; EXT3
To format the partitions type: mkfs.ext3 /dev/hdb1
For the other partitions this would be :
Now it's time to modify the fstab to mount these partitions in the future at boot time.
Let's say that partition1 (/dev/hdb1) will be used to store webpages and you want to mount it under the htdocs directory of apache.
I've installed apache in /opt/apache
but a default installation of Fedora Core will place the www root dir in /var/www
To locate where you web root directory is type : locate htdocs
For this example we'll assume it's locate in /var/www/htdocs
Edit the fstab in the etc directory:
I prefer VI but use any editor you want.
Note:You'll need to be logged in as superuser to modify the fstab.
Insert at the bottom line the following:
/dev/hdb1 /var/www/htdocs ext3 defaults 1 1
Next time you boot partition 1 of the new harddisk will be mounted at /var/www/htdocs
check before rebooting that the dir /var/www/htdocs is empty if not make a copy in your /root/ dir so that the next time you boot up you can place all the file that were there are restored.
(There are different way to do the same, but this is the quickest one for the less experienced ones.)
Now we want partition 2 to mount at /opt
(it's default an empty or non-exising dir.)
And entry in the fstab would look like:
/dev/hdb2 /opt ext3 defaults 1 1
But there are 4 users with data in. Mounting it now there will make all that information 'disappear'. We can't have that...
Mount partition 3 behind folder /mnt , so we can copy all information there.
type:mount -t ext3 /dev/hdb3 /mnt
now start up Midnight commander and copy the contents of /home to the just mounted disk at /mnt
Or cd /home and type: cp -R * /mnt
Wait until everything is done.
Now we can modify the fstab.
And a line like the following:
/dev/hdb3 /home ext3 defaults 1 1
Okies, this should give you a short insight into how to create partitions, format them and mount them at boot time.
For further information type: man fstab and use google---[ MS09-99896 - Vulnerability in All MS Windows OS ; Using Windows Could Allow Remote Code Execution. ]---
Hardware: Asus P4P800, 1GB, P4-3Ghz, Asus V9950, Maxtor ATA HD\'s, 3Com GBit lan, Audigy ZS Plat.