LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 11-07-2005, 11:12 AM   #1
cmlal
Member
 
Registered: Oct 2005
Location: Stockholm, Sweden
Distribution: Ubuntu 5.10
Posts: 55

Rep: Reputation: 15
Question Formatting/partitioning my back up hard disk


Hi!

I'm confused and need help. I think my main problem is that I reinstalled SuSE 10.0 (because my computer sort of crashed) and then remounted my second hard drive (which doesn't contain an OS, just my Important Files (music, images, documents etc) from WinXP). I don't remember what I wrote in the line that I added the first time in fstab (I got the instructions from someone over the phone), but it worked better the first time. Maybe another file system? Cos this time all I get is trouble. (Wrote about it here: Can't change privileges for my second harddrive...) I think the file system I use now is NTFS (YaST tells me HPFS/NTFS).

I just want this hd to be fully compatible with Linux. I am not going to dual boot with Windows, only other Linux distros (perhaps, not planning on it in the near future though). (I want to get rid of SuSE and install Slackware when I've made sure all my files are safely backed up on this separate hard disk.)

I have tried the partitioner thingie in YaST and I've tried cfdisk (but it only lists partitions and info on hda and the harddisk I want to fix is hdb (and hdb1 it seems..)). YaST tells me I really shouldn't try to partition or format anything unless I'm an expert and I sure am not! I've also tried reading a few articles on LQ about partioning, but I'm still confused.

I just need this hd to be my sort of back up disk and so I don't need to make partitions like /home and /swap and things like that.

I really hope this makes some sort of sense to some of you, because I don't even know how to ask this question. All I seem to do is stumble over more info that I don't quite know how to use (like low level and high level formatting, hmmm).

Today is my 2 week Linux anniversary, so I'm just a newbie. It would be wonderful if someone could give me some advice on what to do. Thank you so much!
 
Old 11-07-2005, 11:40 AM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,087

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
OK, we need to go carefully here, as I am not 100% sure what you want to do.
You have managed to get your files off your "spare" hard disk - Yes?
This "spare" disk is currently formatted as "NTFS".
You want this disk to be compatible with linux, for backups etc.
You do not have any data on this disk that you want to keep!

NTFS is a windows filing system. It is not compatibe with linux in the sense that it is dangerous (data loss) to write to NTFS from linux. This is because nobody apart from MS is entirely certain how NTFS works, and MS aren't saying.

So you need to wipe the disk and reformat it for linux.

Here is how to do this:

Find out which disk is your "NTFS" disk. It is probably /dev/hdb . Check like this (you will need to be root for all of these commands, so take care please)
fdisk /dev/hdb
Then press m to print the command menu, and then p to list the partition table. You should see something about NTFS and nothing about linux. If that is the case, you can destroy all the windows partitions on /dev/hdb using the single-letter commands that fdisk uses. (Remember m for help). However, if you can see your linux partitions, you have the wrong disk, so exit fdisk (q) and restart it with a different disk (eg /dev/hda ) - check again that you are looking at the right disk!!

Now create at least one linux partition, still using fdisk.
Then write the changes to the disk and exit fdisk.

Now you need to format your partition(s) with a linux filesystem. There are several, but I just use ext3:

mkfs -t ext3 /dev/hda1 Wait until it finishes.

That was easy.
Now you need somewhere to mount your disk:
mkdir /mnt/spare
Now mount the disk:
mount -t ext3 /dev/hda1 /mnt/spare

Now you can use it.

If you want it mounted at boot time you will need to add this to your /etc/fstab file:

/dev/hda1 /mnt/spare ext3 defaults 1 2

That is about it.
 
Old 11-07-2005, 12:38 PM   #3
cmlal
Member
 
Registered: Oct 2005
Location: Stockholm, Sweden
Distribution: Ubuntu 5.10
Posts: 55

Original Poster
Rep: Reputation: 15
This was incredibly helpful, exactly what I needed!

I think I have managed to partition the hd now. I ran fdisk again just to make sure, got this when typing p and enter:

Code:
    Device Start     Beginning        End     (?)    Id  System
 /dev/hdb1               1       10011    80413326   83  Linux
Then I tried this:

Code:
linux:/home/cam # mkfs -t ext3 /dev/hdb
mke2fs 1.38 (30-Jun-2005)
/dev/hdb is the whole device/unit, not just a partition!
Continue? (y,n) y
/dev/hdb is used by the system; won't create a file system here!
(If the choice of words seem strange it's probably because I've translated from Swedish.)

Do I need to unmount it? How do I do that?
 
Old 11-07-2005, 01:05 PM   #4
ethics
Senior Member
 
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
From your post above you are trying to format the DEVICE as ext3, which it won't let you do, try

mkfs -t ext3 /dev/hdb1

This will format the partition which should be fine.

/dev/hdb is your second drive, /dev/hdb1 is a partition on that drive
 
Old 11-07-2005, 01:08 PM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,087

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
No, the disk must be unmounted for you to be able to format it, so leave it alone!
Quote:
linux:/home/cam # mkfs -t ext3 /dev/hdb
mke2fs 1.38 (30-Jun-2005)
/dev/hdb is the whole device/unit, not just a partition!
Read my previous post carefully: You need a "1" at the end of the command:

mkfs -t ext3 /dev/hdb1

Even though that partition is the whole disk.

Have fun
 
Old 11-07-2005, 01:20 PM   #6
cmlal
Member
 
Registered: Oct 2005
Location: Stockholm, Sweden
Distribution: Ubuntu 5.10
Posts: 55

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by ethics
/dev/hdb is your second drive, /dev/hdb1 is a partition on that drive
Ah! Of course. Thank you! :)
 
Old 11-07-2005, 01:22 PM   #7
cmlal
Member
 
Registered: Oct 2005
Location: Stockholm, Sweden
Distribution: Ubuntu 5.10
Posts: 55

Original Poster
Rep: Reputation: 15
Everything seems to be fine. I named it extra instead of spare though. And in my formatted extra directory I have a directory called "lost + found", what is that about?
 
Old 11-07-2005, 02:06 PM   #8
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,087

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
Well done!
"lost + found" is where fsck puts bits of files that were rescued from a filesystem f??k-up when it recovers the filesystem. You can safely ignore it.

Now your disk is formatted and mounted, you might do a df -h to see how much space is available on it (did you partition it correctly?), and if all is OK, add an entry to /etc/fstab (see my first post to you) so it is mounted at boot time (if this is what you'd like).

Sigh of relief.
 
Old 11-07-2005, 03:04 PM   #9
cmlal
Member
 
Registered: Oct 2005
Location: Stockholm, Sweden
Distribution: Ubuntu 5.10
Posts: 55

Original Poster
Rep: Reputation: 15
Sigh of relief, for sure.

I added the line to fstab. Just out of curiosity: what does "defaults 1 2" mean?

I understand the rest. :)

Thank you very much for your excellent help!
 
Old 11-07-2005, 03:06 PM   #10
cmlal
Member
 
Registered: Oct 2005
Location: Stockholm, Sweden
Distribution: Ubuntu 5.10
Posts: 55

Original Poster
Rep: Reputation: 15
Also, can I remove the "lost + found" dir?
 
Old 11-08-2005, 03:36 AM   #11
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,087

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
Quote:
I added the line to fstab. Just out of curiosity: what does "defaults 1 2" mean?
man fstab and
man mount will explain these options.
Quote:
Also, can I remove the "lost + found" dir?
Yes, but it will be re-created as necessary by fsck
 
  


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
Hard disk partitioning Michael Davont Fedora - Installation 3 01-15-2005 10:26 AM
Partitioning a hard disk humanrig Linux - Hardware 2 03-15-2004 08:38 AM
Doubt on Partitioning hard disk ! shaahul Linux - Newbie 4 09-11-2003 09:59 AM
Maxtor 120GB hard disk formatting lichad Linux - Hardware 1 08-31-2003 08:14 PM
hard disk partitioning autorun Linux - General 7 10-09-2002 09:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:30 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