LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 06-20-2006, 06:27 PM   #1
bellaterror
LQ Newbie
 
Registered: Jun 2006
Posts: 11

Rep: Reputation: 0
Formatting this hard drive


I am using Ubuntu linux and am pretty new I used this command to format a 2nd drive newly added

# sudo mkfs -t ext2 /dev/hdd

and am coming up with this

/dev/hdd is apparently in use by the system; will not make a filesystem here!

is there a way to make it not used by file system or something so that I can format it??
 
Old 06-20-2006, 07:09 PM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
First have you partitioned the drive?
If so then you need to define the partition to format.
sudo mkfs -t ext2 /dev/hdd1
Also the partition can't be already mounted. Must be unmounted to format.

Brian1
 
Old 06-21-2006, 09:49 AM   #3
penguintutor
Member
 
Registered: Jun 2006
Location: UK
Distribution: Ubuntu, Mandriva, Redhat and Fedora
Posts: 118

Rep: Reputation: 15
If you have just added the disk then you need to partition it first, use
Quote:
cfdisk /dev/hdd
or if that doesn't work fdisk, but cfdisk is easier to use.

and then partition up the drive. If you only need one partition then you can just create it as a single primary partition giving you /dev/hdd1
 
Old 06-21-2006, 02:15 PM   #4
bellaterror
LQ Newbie
 
Registered: Jun 2006
Posts: 11

Original Poster
Rep: Reputation: 0
Okay, is there a code for unmounting a drive then because I had already tried the code brian submitted and because it is mounted it will not let me format it.

(I'll try code that penguinator submit after unmount)
~thanks for the patience
 
Old 06-21-2006, 03:24 PM   #5
bellaterror
LQ Newbie
 
Registered: Jun 2006
Posts: 11

Original Poster
Rep: Reputation: 0
Okay tell me of this code needs to be edited unmount /dev/hdd because I tried this which someone said works and all it is saying command not found...
 
Old 06-21-2006, 05:31 PM   #6
ScottReed
Member
 
Registered: Dec 2005
Location: Montana
Distribution: Debian "squeeze"
Posts: 157

Rep: Reputation: 30
All of this as root user!

First, type mount

Code:
mount
Press enter

Second, look in output of 'mount' for anything related to /dev/hdd

IF you see something related to /dev/hdd (example: /dev/hdd1) THEN:

Code:
umount /dev/hdd1
ELSE, type fdisk /dev/hdd

Code:
fdisk /dev/hdd
Press enter

Type p and press enter

Look at output and see if any partitions exist, if so they will be listed as /dev/hdd1 /dev/hdd2 /dev/hdd3 etc... If none exist then you need to create one or more. Otherwise just type q and press enter.

OK, back at command line...

Type mke2fs /dev/hdd1

Code:
mke2fs /dev/hdd1
or for ext3 (journaled) filesystem...

Code:
mke2fs -j /dev/hdd1
NOTE: Pick ONE of those above...

Press enter

Filesystem will be created.

Now to mount the new filesystem...

Code:
mkdir /mnt/my_drive
press enter

Code:
mount /dev/hdd1 /mnt/my_drive
press enter

Done. Research fstab for automounting this partition and what-not

Code:
man fstab
press enter
 
Old 06-21-2006, 06:52 PM   #7
bellaterror
LQ Newbie
 
Registered: Jun 2006
Posts: 11

Original Poster
Rep: Reputation: 0
Thank you much ScottReed but now that it's there I access it and it has a folder of lost+found which I cannot access and I can't create any new folders because it's saying I do not have permission...
 
Old 06-21-2006, 07:04 PM   #8
bellaterror
LQ Newbie
 
Registered: Jun 2006
Posts: 11

Original Poster
Rep: Reputation: 0
Another side question I have is that is there a way to get rid of partitions off a drive because in the Administration>Disks there is a greyed out delete and create buttons when you have a partition selected, so they are no help.
 
Old 06-22-2006, 05:51 AM   #9
penguintutor
Member
 
Registered: Jun 2006
Location: UK
Distribution: Ubuntu, Mandriva, Redhat and Fedora
Posts: 118

Rep: Reputation: 15
Every partition has a lost+found directory. Normally you can just ignore that. It is used if a files descriptor becomes corrupt, and so it doesn't know where the file originally came from.

As root you will need to grant permissions to everyone that wants to access the disk.

This can be done by changing the ownership of the directory
chown user /mnt/my_drive

or by granting access to all users
chmod 777 /mnt/my_drive

Alternatively you could use groups, but I'm guessing you have only a few users on this system and don't need that level of control.


Is the partition you want to get rid of still mounted?
You should have noticed from ScottReed's post that the command to unmount a filesystem is umount - note the only 'n' is before the t.
 
Old 06-24-2006, 11:00 AM   #10
bellaterror
LQ Newbie
 
Registered: Jun 2006
Posts: 11

Original Poster
Rep: Reputation: 0
thank you penguin tutor for your help with the permissions and yes I finally saw that after a bit my eyes kind of repeatedly tricked me because I was thinking unmount so thats what I was putting thank you for all your help you'll probably see me asking more n00bish questions elsewhere at another time. >:]
 
  


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
Formatting hard drive Sparkfist Linux - General 9 05-24-2006 10:18 PM
Formatting a Hard Drive dudeman41465 Linux - Software 3 10-13-2005 05:09 PM
Hard-drive formatting kc0bus Linux - Newbie 5 07-02-2005 01:14 PM
Formatting Hard Drive baber_abbasi Linux - Software 2 01-04-2005 09:41 AM
Formatting hard drive... Linux~Powered Linux - Hardware 1 02-09-2004 05:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 09:12 PM.

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
Open Source Consulting | Domain Registration