Thêm HDD cho CentOS theo các bước sau

Buoc1

Su dung lenh fdisk -l de xem thong tin ve he thong parttion nhu the nao

[root@DCUONGLINUX ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          19      152586   83  Linux
/dev/sda2              20        1462    11590897+  83  Linux
/dev/sda3            1463        2482     8193150   83  Linux
/dev/sda4            2483        2610     1028160    5  Extended
/dev/sda5            2483        2609     1020096   82  Linux swap / Solaris

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       10240    10485744    5  Extended
/dev/sdb5               1       10240    10485728   83  Linux

Disk /dev/sdc: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Disk /dev/sdc doesn’t contain a valid partition table
[root@DCUONGLINUX ~]#

Sau khi chay len tren,ket qua se nhu tren.Co 3 dev nhung chi co 2 dev hien hanh da dcuo mount.
Vi vay ta se tien format va mount thiet bi thu 3 co ten la /dev/sdc

Buoc2

Tien hanh chia parttion cho /dev/sdc voi lenh sau

[root@DCUONGLINUX ~]# fdisk /dev/sdc
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 10240.
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)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help):

Sau khi chay lenh # fdisk /dev/sdc se xuat hien ket qua nhu tren,ban go vao m va ket qua tiep theo se nhu sau

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):

Tai day cac ban chon n de add them parttion

Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
e
Partition number (1-4): 1
First cylinder (1-10240, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-10240, default 10240):
Using default value 10240

Command (m for help):

Cac ban cu de gia tri mac dinh la ok.Ke tiep chon p de cho ta thay parttion ma ban vua tao ra

Command (m for help): p

Disk /dev/sdc: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       10240    10485744    5  Extended

Command (m for help):

Wow.Ket qua nhu tren la ban da tao duoc parttion Extended cho o dia cung vua moi add vao server roi do.
Do la phan Extended.Bay gio tao se tao mot parttion goi la Logical su dung het dung luong o dia cung ma ban add vao server

Command (m for help): n
Command action
l   logical (5 or over)
p   primary partition (1-4)
l
First cylinder (1-10240, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-10240, default 10240):
Using default value 10240

Command (m for help): p

Disk /dev/sdc: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       10240    10485744    5  Extended
/dev/sdc5               1       10240    10485728   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@DCUONGLINUX ~]#

Den day coi nhu la da xu ly xong phan tao parttion roi do ban.Hihihi . . .
Bay gio chi can format va su dung nua ma thoi

[root@DCUONGLINUX ~]# mkfs -t ext3 /dev/sdc5
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1310720 inodes, 2621432 blocks
131071 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 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

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@DCUONGLINUX ~]#

Da dinh dang xong o dia cung roi.Bay gio mount len thu muc nao do de su dung thoi

[root@DCUONGLINUX ~]# mkdir /CUTI
[root@DCUONGLINUX ~]# mount -t ext3 /dev/sdc5 /CUTI

Cuối cùng cần phải cập nhật /etc/fstab để hệ thống tự mount khi boot:
Thêm dòng sau vào /etc/fstab:

[root@DCUONGLINUX ~]# vi /etc/fstab

/dev/sdc5               /CUTI                  ext3    defaults        1 2

LABEL=/                 /                       ext3    defaults        1 1
LABEL=/home             /home                   ext3    defaults        1 2
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP-sda5         swap                    swap    defaults        0 0
/dev/sdb5               /home/www/              ext3    defaults        1 2
/dev/sdc5               /home/CUTI              ext3    defaults        1 2

Vay la ok roi do.

Enjoy it

Cu Tí

Gửi phản hồi

Mời bạn điền thông tin vào ô dưới đây hoặc kích vào một biểu tượng để đăng nhập:

WordPress.com Logo

Bạn đang bình luận bằng tài khoản WordPress.com Log Out / Thay đổi )

Twitter picture

Bạn đang bình luận bằng tài khoản Twitter Log Out / Thay đổi )

Facebook photo

Bạn đang bình luận bằng tài khoản Facebook Log Out / Thay đổi )

Google+ photo

Bạn đang bình luận bằng tài khoản Google+ Log Out / Thay đổi )

Connecting to %s

%d bloggers like this: