Link to home
Start Free TrialLog in
Avatar of MichaelPro
MichaelPro

asked on

New Harddrive added, how do i format and label it? Very Simple

Hello,
I have a very simple question. i added a new harddrive in CentOS. I want to format it and name it as /backup . How do i do that? Can you please provide the command. i have access to SSH shell and graphical console but i prefer to do this through SSH. Also, the drive might have already been formated (it's brand new drive, maybe formated with FAT32 or something).

thanks,
Michael
Avatar of wesly_chen
wesly_chen
Flag of United States of America image

Say your new partition is /dev/hdb1, then as root
# e2label /dev/hdb1  /backup
# mkdir /backup
# echo "LABEL=/backup           /backup               ext3      defaults    1 2" >> /etc/fstab
> maybe formated with FAT32 or something).
Please post the result of the following command here:
# fdisk -l
Avatar of MichaelPro
MichaelPro

ASKER

Here it is:
------------------------------------------------------------
[root@cpanel ~]# fdisk -l

Disk /dev/hda: 64.4 GB, 64423526400 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        7832    62806117+  8e  Linux LVM

Disk /dev/hdb: 64.4 GB, 64423526400 bytes
16 heads, 63 sectors/track, 124828 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Disk /dev/hdb doesn't contain a valid partition table
[root@cpanel ~]#
------------------------------------------------------------

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of wesly_chen
wesly_chen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks,
it worked with slight modification

# fdisk /dev/hdb
n
Enter
p
Enter
enter partition number (1-4):    <-- for one partition press 1
Enter   (for default maximum available size)
Enter   (for default maximum available size)
(Maybe another Enter)
w
# /sbin/mke2fs -j /dev/hdb1
# e2label /dev/hdb1  /backup
# mkdir /backup
# echo "LABEL=/backup           /backup               ext3      defaults    1 2" >> /etc/fstab
# mount /backup


thanks,!
Thanks for post the correct solution.