LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 02-14-2011, 08:47 PM   #16
JeffC1
Member
 
Registered: May 2008
Posts: 89

Original Poster
Rep: Reputation: 15

Still struggling. I think this disk is bad. At a lost here..
 
Old 02-14-2011, 09:23 PM   #17
JeffC1
Member
 
Registered: May 2008
Posts: 89

Original Poster
Rep: Reputation: 15
When I run fsdk, I also get


The number of cylinders for this disk is set to 243199.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
 
Old 02-14-2011, 09:36 PM   #18
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
After reading over everything, in a way, it does sound like a f*ck*d drive. Sorry man :/
 
Old 02-15-2011, 03:03 AM   #19
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
You can also try this:
1. Unmount the drive.
2. do a
Code:
dd if=/dev/zero of=/dev/sdb bs=512 count=1
This will zero out the partition table.
3. Now use a partitioning tool like fdisk, cfdisk or GParted to create a new partition table and a new partition.
 
Old 02-15-2011, 08:00 AM   #20
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
Before you write off that drive you might want to follow these steps;

1- TobiSGD's advice on zeroing the boot/partition table will assure that you are starting from scratch. So here it is again:

Code:
dd if=/dev/zero of=/dev/sdb bs=512 count=1
The above assumes sdb as the device you want to zero.

NOTE: By device I mean sdb NOT sdb1 or any of its partitions.

2- Reboot the machine.

3- Run the following command:

Code:
fdisk -l
This will list all of the available hard drives on the system. Verify in the output that your drive is there and has no partitions defined (i.e. sdb1, sdb2 ... ) if it has partitions defined then dd was unable to zero the partition table and there is a problem.

4- Using fdisk or whatever partitioning tool you choose, create your new partition. If you use fdisk it should go like this:

fdisk /dev/<device_here>
n
p
1
<accept default of 1>
<accept default for the last cylinder>
p (verify your partition with output here)
w (This will write your changes to disk)

The output from an actual fdisk session for a 160 GB disk follows:

Code:
$ fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x344fdc64.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').


Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-19457, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-19457, default 19457): 
Using default value 19457

Command (m for help): p

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x344fdc64

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       19457   156288321   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
5- Now you can format the partition with the file system of your choice. For example to format as ext3:

Code:
mkfs.ext3 /dev/sdb1
Note: We now use the partition name (i.e. sdb1 ) rather than the device name (sdb) which will format the partition using an ext3 file system.

Once this is done you should be able to use your new drive (sdb) with its new partition (sdb1)

If you have questions regarding any of this please post them.


Regards,

Fordeck

Last edited by fordeck; 02-15-2011 at 08:02 AM.
 
Old 02-15-2011, 08:22 AM   #21
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,695

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
There is nothing wrong with the drive. mkfs does not automatically change the partition ID. Use fdisk to manually change the type to 83 i.e linux. FYI linux does not use the partition ID and you should be able to mount the partition as is.
 
Old 02-15-2011, 09:27 AM   #22
JeffC1
Member
 
Registered: May 2008
Posts: 89

Original Poster
Rep: Reputation: 15
fsck -fpv /dev/sdb1
fsck 1.39 (29-May-2006)

11 inodes used (0.00%)
1 non-contiguous inode (9.1%)
# of inodes with ind/dind/tind blocks: 0/0/0
7713453 blocks used (1.58%)
0 bad blocks
1 large file

0 regular files
2 directories
0 character device files
0 block device files
0 fifos
0 links
0 symbolic links (0 fast symbolic links)
0 sockets
 
Old 02-15-2011, 10:11 AM   #23
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,695

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
Are you able to mount the partition?
 
Old 02-16-2011, 08:21 PM   #24
JeffC1
Member
 
Registered: May 2008
Posts: 89

Original Poster
Rep: Reputation: 15
So i tried a brand new drive and get the same result. Theres something wrong with my process.
Trying from scratch again..
 
Old 02-16-2011, 08:23 PM   #25
JeffC1
Member
 
Registered: May 2008
Posts: 89

Original Poster
Rep: Reputation: 15
Does anyone have a step by step guide to do this?

I read a guide that told me I had to press o and create a blank dos partition before starting? very confusing

please help

Code:
Overview

    This article presents the commands used to partition and format a second hard drive in Linux using the ext3 file system. For the purpose of this example, I installed a second hard drive in a Red Had Linux system where the drive is recognized as /dev/hdb. I want to make only one partition on this hard drive which will be /dev/hdb1. 

fdisk

    First, you will need to run the fdisk command in order to partition the disk. For this example, I only want to create one ext3 partition. Here is an example session:

    [root@linux2 etc]# fdisk /dev/hdb
    Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
    Building a new DOS disklabel. Changes will remain in memory only,
    until you decide to write them. After that, of course, the previous
    content won't be recoverable.


    The number of cylinders for this disk is set to 4865.
    There is nothing wrong with that, but this is larger than 1024,
    and could in certain setups cause problems with:
    1) software that runs at boot time (e.g., old versions of LILO)
    2) booting and partitioning software from other OSs
       (e.g., DOS FDISK, OS/2 FDISK)

    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 1
    First cylinder (1-4865, default 1): 1
    Last cylinder or +size or +sizeM or +sizeK (1-4865, default 4865): 4865

    Command (m for help): t
    Partition number (1-4): 1
    Hex code (type L to list codes): 83

    Command (m for help): w
    The partition table has been altered!

    Calling ioctl() to re-read partition table.
    Syncing disks.

Create ext3 File System

    The next step is to create an ext3 file system on the new partition. Provided with the distribution is a script named /sbin/mkfs.ext3. Here is an example session of using the mkfs.ext3 script:

    [root@linux2 root]# mkfs.ext3 -b 4096 /dev/hdb1
    mke2fs 1.27 (8-Mar-2002)
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    4889248 inodes, 9769520 blocks
    488476 blocks (5.00%) reserved for the super user
    First data block=0
    299 block groups
    32768 blocks per group, 32768 fragments per group
    16352 inodes per group
    Superblock backups stored on blocks:
            32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
            4096000, 7962624

    Writing inode tables: done
    Creating journal (8192 blocks): done
    Writing superblocks and filesystem accounting information: done

    This filesystem will be automatically checked every 36 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.
I performed these steps with no luck. Im getting

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 22: Invalid argument.

Last edited by JeffC1; 02-16-2011 at 08:27 PM.
 
Old 02-16-2011, 08:27 PM   #26
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
First off, I am saying sorry to my most recent post about the drive being messed up.

That being said, it really seems that you are missing something important here that you are not telling us. So a step by step guide might be good in your case.

http://www.ehow.com/how_1000631_hard-drive-linux.html

Please post any errors or warnings what-so-ever you get.
 
Old 02-16-2011, 08:37 PM   #27
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,695

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
Quote:
So I tried a brand new drive and get the same result
Please post what commands/steps you accomplished.
The only obvious error I noticed was not changing the partition ID from HPFS/NTFS to linux.
Did you ever try to mounting the other drive?
 
Old 02-16-2011, 08:37 PM   #28
JeffC1
Member
 
Registered: May 2008
Posts: 89

Original Poster
Rep: Reputation: 15
Thanks. I did not perform this step

Code:
You now need to set the filesystem type for your new partition with the "t" command. You are asked for the Hex code of the filesystem you wish to use. We will use the standard Linux ext2 filesystem, which is "83." If you are doing something special and know of a particular filesystem that you need to use, you can press "L" to see all the codes, which are one or two characters made up of the numbers 0 to 9 and the letters a to f.

Read more: How to Format a Hard Drive in Linux | eHow.com http://www.ehow.com/how_1000631_hard-drive-linux.html#ixzz1EBDB4ukI
However received the error when writing. ie: error22 invalid argument.
I just ran mkfs -t ext2 now on /dev/sdb1
 
Old 02-16-2011, 08:48 PM   #29
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,317
Blog Entries: 28

Rep: Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140
I think that fdisk (or cfdisk) will just create the partition.

To create a file system, follow them with mkfs.

http://www.computerhope.com/unix/mkfs.htm
 
Old 02-16-2011, 08:48 PM   #30
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,695

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
Just reboot the computer.
 
  


Reply



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
NTFS Configuration Tool Can Not Detect SATA drive in NTFS format jlconferido Linux - Newbie 7 06-30-2007 07:07 PM
Hpfs/ntfs Bobymc Linux - Software 2 04-22-2006 10:58 PM
HPFS / NTFS problem C: partition appears to be empty thk33 Linux - Software 2 08-11-2004 10:22 AM
Lost XP HPFS/NTFS partition ajkhan Linux - General 3 09-19-2003 07:54 AM
how to moutn hpfs/ntfs farhan Linux - General 3 03-10-2003 08:08 PM

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

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