Add secondary Hard Disk in Linux/RHEL/CentOS
Step I
Make use you are under root mode.
- # su -
Step II
Check your hard disk list
- [root@localhost ~]# fdisk -l
- Disk /dev/sda: 500.1 GB, 500107862016 bytes
- 255 heads, 63 sectors/track, 60801 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
- Device Boot Start End Blocks Id System
- /dev/sda1 1 7 56196 de Dell Utility
- /dev/sda2 * 8 7187 57671680 7 HPFS/NTFS
- /dev/sda3 7187 32684 204800000 7 HPFS/NTFS
- /dev/sda4 32685 60801 225849802+ 5 Extended
- /dev/sda5 32685 39058 51199123+ 83 Linux
- /dev/sda6 39059 39319 2096451 82 Linux swap / Solaris
- /dev/sda7 39320 60801 172554133+ 83 Linux
- Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
- 255 heads, 63 sectors/track, 121601 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
- Disk /dev/sdb doesn't contain a valid partition table
Step 3
Initialize the hard disk.
[root@]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. 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): 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): 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): <enter> Using default value 30515 Command (m for help):
You may set your disk as your wish, please press "m" to get help.
Now that we’ve created the partition scheme we’d like, we need to write the changes to the disk partition table.
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@quetzalcoatl ~]#
Step 4
Format the new partition
Step 5
Create mount point and set up automatic mount when system start up.
- [root@localhost ~]# mkdir /newdisk
Add the following line into fstab.
- #vim /etc/fstab
/dev/sdb1 /newdisk ext3 default 0 1
No comments:
Post a Comment