Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-14-2004, 08:18 AM   #1
LQ Newbie
Registered: Sep 2004
Posts: 20

Rep: Reputation: 0
formating a disk

I'm trying to format /dev/hdd but don't know how to do. If I were using X I could do it, but this computer doesn't have X installed. Is there any program for the console that can format disks? It's running on Mandrake 10.0

I have searched around a bit but all I could find was fdformat, which formats floppy disks.
Old 10-14-2004, 08:22 AM   #2
Registered: Sep 2004
Distribution: Slack!
Posts: 150

Rep: Reputation: 15
mkfs is the typical format command for Linux.

To what filesystem are you trying to format? To format to a specific filesystem, there should be commands like mkfs.ext2, mkfs.ext3, mkfs.reiser, mkfs.vfat, etc.
Old 10-14-2004, 11:31 AM   #3
Registered: Nov 2003
Location: austria
Distribution: debian
Posts: 667

Rep: Reputation: 30
you have to partition the disk first. here are a few console programs to do so:
cfdsik, fdisk, parted /dev/hdd
read the manpages before, since you can mess up a lot with such tools. on ide drives you can have up to four primary partitions but more extended ones. if you want to read more 'bout this read some of the howtos at .now create your partitions. example: one big for the system, one small (128MB-2G) for swap and one medium for your /home directory. they will get called hdd1, hdd2 and hdd3. now it's up to formatting the partitions. there are different tools for the kind of filesystem you want to use. linux old filoesystem was ext2 which now got a journal and is called ext3. it's often used on standard linux installations.

here is how to create a ext3 partition:
mke2fs -j -c /dev/hdd1
the -c option only tells mke2fs to check the disk readonly (non destructive) for bad blocks, so you can leave it away. the -j option is used to create a new journalled filesystem.

here is how to create a swap partition:
mkswap -c -v1 /dev/hdd2
-v1 is the newer format needed for 2.6 linux-kernels.

there are other filesystems like reiserfs (mkreiserfs), dos (forget about unless for diskettes), xfs and other, but i think going with ext3 is ok unless you need special performance for some kind of application.

mke2fs will adjust blocksize (and other) for best usage of the disk automatically, however if you want to run the disk as a mail or news spool you'll like to tune it for your needs. read the manpage for more info.

if it's formated you can mount it for example with:
mount -t ext3 /dev/hdd1 /mountpoint
and when everything is right and you want the partition to get mounted at bootup put the following line in your /etc/fstab:
/dev/hdd1 /mountpoint ext3 defaults 0 2

note: the directory where you want to mount the partition must exist.

sl mritch.

Last edited by mritch; 10-14-2004 at 11:34 AM.


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
Formating USB Disk became readonly ReesAcheson Linux - Newbie 2 10-26-2005 09:42 AM
Formating Eugney Linux - Newbie 2 05-02-2005 04:50 AM
formating mfds Linux - Software 7 04-14-2004 12:15 PM
formating Galilee Linux - Software 2 10-01-2003 12:23 AM
Formating iomag zip disk brown Linux - Newbie 9 01-30-2003 01:49 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:34 PM.

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