LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-30-2006, 06:59 PM   #1
netrambler
LQ Newbie
 
Registered: Feb 2003
Location: Glenview, IL
Distribution: Fedora Core 6
Posts: 8

Rep: Reputation: 0
Trouble partioning and formatting new hard drive


I'm new to Linux and I recently installed Fedora Core 6 and MythTV (kernel 2.6.18-1.2868.fc6). I have an existing Western Digital SATA 120 GB hard drive and I'm attempting to add an additional Western Digital SATA 250 GB drive. I've been trying to partion and format the new drive using fdisk and mkfs but have been having trouble. In particular, I have attempted the following:

Code:
[root@localhost mnt]# fdisk /dev/sdb

The number of cylinders for this disk is set to 30401.
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): p

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       30401   244196001   85  Linux extended

Command (m for help): d
Selected partition 1

Command (m for help): p

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

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

Command (m for help): p

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       30401   244196001    5  Extended

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 85
Changed system type of partition 1 to 85 (Linux extended)

Command (m for help): p

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       30401   244196001   85  Linux extended

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost mnt]# fdisk /dev/sdb

The number of cylinders for this disk is set to 30401.
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): p

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       30401   244196001   85  Linux extended

Command (m for help): q

[root@localhost mnt]# mkfs -t ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
/dev/sdb1: Invalid argument passed to ext2 library while setting up superblock
[root@localhost mnt]#
I'm getting the "/dev/sdb1: Invalid argument passed to ext2 library while setting up superblock" error when I try to format the new partition. What am I doing wrong?

Thanks,
Dave

Last edited by netrambler; 12-30-2006 at 07:01 PM.
 
Old 12-30-2006, 07:22 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,000

Rep: Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873
Extended partition is a container for logical(s) - you can't use it (directly) for data. Go back in and create a logical partition within that extended, and use that. BTW, you can have multiple logicals; the first logical doesn't have to use all the space.
 
Old 12-30-2006, 07:23 PM   #3
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
If I read all this correctly, you have created an extended partition on sdb. Extended partitions are a device for getting around the limitation of 4 primary partitions listed in the MBR. They are containers which will be counted as primary partitions for MBR purposes.

After creating the extended partition, it is then necessary to create logical partitions inside the extended partition, and format those logical partitions. Then you can install operating systems or write files to the logical partitions.

Basically, you have gone part-way to doing what you want to do. Not go back to fdisk (or cfdisk) and create logical partitions inside the extended partition.
 
Old 12-30-2006, 07:34 PM   #4
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 334Reputation: 334Reputation: 334Reputation: 334
syg00 and bigrigdriver, your diagnosis is correct but your remediation plan is terrible. Why keep an extended partition when there isn't even a single primary partition?

netrambler, the partition type should be 83 not 85. Also if your system has the cfdisk utility you would probably be happier using that than to use the fdisk utility. cfdisk has an ncurses graphical display. (ncurses is a library to create lines and position the cursor on text terminals or terminal windows.)

Code:
cfdisk /dev/sdb
Use the up/down arrow keys to select the existing partition. Use the right/left arrow keys to select [DELETE] and then press the Enter key. Then select [NEW] and press Enter. Use the default start point and size and press Enter. Use the arrow keys to select [TYPE] and press Enter. Make the partition type 83. Then use the arrow keys to select [WRITE]. Write the new partition table to the disk. Then exit from cfdisk.

Check your work by using the fdisk utility with the -l parameter.
Code:
fdisk -l
You will see a listing of partitions for both of your disks. The new partition on /dev/sdb should be identified as a Linux primary partition. If everything looks good then format the new disk partition as you had already attempted to do.
Code:
mkfs -t ext3 /dev/sdb1
That should be it.

Last edited by stress_junkie; 12-30-2006 at 07:43 PM.
 
Old 12-30-2006, 08:06 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,000

Rep: Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873Reputation: 2873
Quote:
Originally Posted by stress_junkie
Why keep an extended partition when there isn't even a single primary partition?
Why not ???. I defy anyone to show any adverse impact - especially under Linux.
 
Old 12-30-2006, 08:23 PM   #6
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 334Reputation: 334Reputation: 334Reputation: 334
Quote:
Originally Posted by syg00
Why not ???. I defy anyone to show any adverse impact - especially under Linux.


Well. You know. Because. Just because.

If the entire disk is used by an extended partition with embedded logical partitions then won't the partition numbers in /dev/sdb start at 5? That's just, you know, kinda weird.

I haven't used extended partitions on any platform since I stopped using MS-DOS v3. However, as disks get bigger and I hate to waste blocks on small files I may have to start using more than 4 partitions per disk in order to keep my block/cluster sizes as small as possible. Even now I hate storing a 32 byte file in a 4K disk block.

Last edited by stress_junkie; 12-30-2006 at 08:29 PM.
 
Old 12-30-2006, 10:41 PM   #7
netrambler
LQ Newbie
 
Registered: Feb 2003
Location: Glenview, IL
Distribution: Fedora Core 6
Posts: 8

Original Poster
Rep: Reputation: 0
I think I got it to work. I did the following:

Code:
[root@localhost boot]# fdisk /dev/sdb

The number of cylinders for this disk is set to 30401.
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): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): p

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       30401   244196001   85  Linux extended

Command (m for help): d
Selected partition 1

Command (m for help): p

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost boot]#
[root@localhost boot]# fdisk /dev/sdb

The number of cylinders for this disk is set to 30401.
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): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): p

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

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

Command (m for help): p

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       30401   244196001   83  Linux

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost boot]# mkfs -t ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
30539776 inodes, 61049000 blocks
3052450 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
1864 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

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

This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@localhost boot]#
[root@localhost boot]# cd /mnt
[root@localhost mnt]# ls
common  sdb1  video_ext
[root@localhost mnt]# mount -t ext3 /dev/sdb1 /mnt/video_ext
[root@localhost mnt]# ls
common  sdb1  video_ext
[root@localhost mnt]# cd video_ext
[root@localhost video_ext]# ls
lost+found
I'll let you know if I have any problems. Thanks for the help!

Dave
 
Old 12-31-2006, 06:12 AM   #8
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 334Reputation: 334Reputation: 334Reputation: 334
Yes grasshopper. You have succeeded.

If you want the new disk partition to automatically mount when the operating system starts you can put a line in the file /etc/fstab as follows:
Code:
/dev/sdb1   /mnt/video_ext   auto   defaults   0 0
If you want to increase the security of your system my making it impossible to run programs on this disk partition then use this line:
Code:
/dev/sdb1  /mnt/video_ext  auto  defaults,noexec  0 0
Using the noexec option means that even if there is a program on that disk you cannot run it. That is good for security. You can do the same thing with any disk partition. One good idea is to have a partition for your /home directory and then to mount that using the noexec option. That can prevent malicious Java scripts from copying a program to your home directory and running it.

That's just one of many things that you can do to enhance security.

Last edited by stress_junkie; 12-31-2006 at 06:24 AM.
 
Old 12-31-2006, 11:50 AM   #9
netrambler
LQ Newbie
 
Registered: Feb 2003
Location: Glenview, IL
Distribution: Fedora Core 6
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by stress_junkie
If you want the new disk partition to automatically mount when the operating system starts you can put a line in the file /etc/fstab as follows:
Code:
/dev/sdb1   /mnt/video_ext   auto   defaults   0 0
Thanks stress_junkie. I had already edited my /etc/fstab file to do just this.

Quote:
Originally Posted by stress_junkie
If you want to increase the security of your system my making it impossible to run programs on this disk partition then use this line:
Code:
/dev/sdb1  /mnt/video_ext  auto  defaults,noexec  0 0
Using the noexec option means that even if there is a program on that disk you cannot run it. That is good for security. You can do the same thing with any disk partition. One good idea is to have a partition for your /home directory and then to mount that using the noexec option. That can prevent malicious Java scripts from copying a program to your home directory and running it.

That's just one of many things that you can do to enhance security.
However, that I didn't realize. I'll make this change right away. Thanks for the added information.

Dave
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting this hard drive bellaterror Linux - Hardware 9 06-24-2006 10:00 AM
Formatting hard drive Sparkfist Linux - General 9 05-24-2006 09:18 PM
Hard-drive formatting kc0bus Linux - Newbie 5 07-02-2005 12:14 PM
Expert opinion partioning hard drive & making raid 1 coskun Linux - General 0 07-07-2003 08:40 PM
hard drive partioning Eskimo Linux - Newbie 24 11-16-2001 04:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:24 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration