LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-15-2010, 03:59 AM   #1
thetiger2003
LQ Newbie
 
Registered: Apr 2009
Posts: 23

Rep: Reputation: 0
how to detect and format new hard drive


hi
i added new hard drive on a machine running linux redhat linux 5 and i need to define and formate this drive to be usable

thnx and best regards
 
Old 09-15-2010, 04:25 AM   #2
eco
Member
 
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
Hi thetiger2003,

you can simply do (as root) an
Code:
# fdisk -l
That will list all the drives and their partitions.

If the drive had no partitions before hand, it will be easy to identify...

If you still can't find the drive, look into '/etc/fstab' and exclude the drisks you find from the 'fdisk -l' result. That should leave you with a single disk. If that disk has partitions, mount then read only and make sure you're not abut to wipe the wrong disk.

As of now, the drive will be sdz

Code:
# fdisk /dev/sdz
Create a partition (or more) and save. You might have to reboot for the kernel to take the changes.

Now, just use the following command to format it in ext3.
Code:
# mke2fs -j /dev/sdz
now add the disk to the fstab and mount it.

I hope this helps. I'd give you more details but i don't have a shell at hand.

Last edited by eco; 09-15-2010 at 04:27 AM.
 
Old 09-15-2010, 04:27 AM   #3
jmc1987
Member
 
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7/10
Posts: 879

Rep: Reputation: 113Reputation: 113
Are you using Raid or LVM or just trying to add an extra storage mount on what ever mount point you specify.

Formating it you can use with some tools not sure what distro you have so tools can vary. First you need to create the partition and format it befor you can mount it. you can use
Code:
tools to create the partition

parted
cfdisk
fdisk

tools to formate it
mke2fs         creates ext 2 or ext 3 with -j option 
mkfs.ext3      creates ext3
mkfs.reiserfs  Creats a ReiserrFS journaling files system
mkswap         makes swap space
tune2fs        Tunes a file system, setting some features like labels, journaling, and reserved block space.
Give more infomation what you are trying to do or what kind of setup you got going. But here are some things to get started. I sure your distro has most of those.
 
Old 09-15-2010, 04:32 AM   #4
Jebram
LQ Newbie
 
Registered: May 2007
Location: Berlin, FRG
Distribution: Ubuntu
Posts: 22

Rep: Reputation: 4
Try this at a shell prompt/terminal:
sudo cfdisk /dev/sdb
If this shows a list of existing partitions or error message,
then "/dev/sdb" is not the device name of the fresh hard disk.
In that case try "/dev/sdc" and up until you find an
empty storage device of appropriate size. You can create volumes
there and later format them using a command like "sudo mkfs.ext3"
(There are many "mkfs.*" tools).
To better understand PC hard disk partitioning schemes,
you might want to read the relevant Wikipedia articles:
Master_boot_record
BIOS_Boot_Partition_(GPT)

Last edited by Jebram; 09-15-2010 at 04:34 AM.
 
Old 09-15-2010, 11:47 AM   #5
thetiger2003
LQ Newbie
 
Registered: Apr 2009
Posts: 23

Original Poster
Rep: Reputation: 0
i think there is no new disk drives

Click image for larger version

Name:	fdisk1.jpg
Views:	128
Size:	240.7 KB
ID:	4604

Click image for larger version

Name:	fdisk2.jpg
Views:	37
Size:	234.5 KB
ID:	4605

Click image for larger version

Name:	fstab.jpg
Views:	29
Size:	205.7 KB
ID:	4606
 
Old 09-15-2010, 11:55 AM   #6
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,363

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by thetiger2003 View Post
hi
i added new hard drive on a machine running linux redhat linux 5 and i need to define and formate this drive to be usable

thnx and best regards
run

Code:
fdisk -l
It'll show the drive as /dev/sdx or /dev/hdx {x - a,b,c}

If you bought a new hard drive it will show only one

/dev/sdx (if sata)

/dev/hdx (if pata)

So just get the device and format it .

if want to format
in vfat

Code:
mkfs.vfat /dev/<device>
in ext3

Code:
mkfs.ext3 /dev/<device>
and then make a directory and mount the new drive in it.as


Code:
mount -t vfat /dev/<device> /<path to directory>
Code:
mount -t ext3 /dev/<device> /<path to directory>
If you want multiple partitions you can use gparted or fdisk utility .
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
format a hard drive (/dev/hda1) in Reiser fs format Linh Linux - General 7 06-17-2009 06:30 AM
how to detect hard drive mandrakelinux Linux - Newbie 9 04-28-2005 04:14 AM
Bios does not detect hard drive. akihandyman Linux - Newbie 5 02-13-2005 06:47 AM
Why cant linux detect my hard drive? liquid486 Linux - Newbie 5 01-24-2005 07:47 PM
Grub won't detect my second hard drive pumpkin7593 Linux - Software 2 04-25-2004 01:30 PM


All times are GMT -5. The time now is 09:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration