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:
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?
syg00
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.
bigrigdriver
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.
stress_junkie
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.)
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.
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.
netrambler Original Poster
I think I got it to work. I did the following:
I'll let you know if I have any problems. Thanks for the help!
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:
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:
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.
REFERENCES
http://www.linuxquestions.org/questions/linux-general-1/trouble-partioning-and-formatting-new-hard-drive-515018/
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]#
syg00
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.
bigrigdriver
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.
stress_junkie
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
Check your work by using the fdisk utility with the -l parameter.
Code:
fdisk -l
Code:
mkfs -t ext3 /dev/sdb1
I think I got it to work. I did the following:
Code:
[root@localhost boot]# fdisk /dev/sdb<br /><br />The number of cylinders for this disk is set to 30401.<br />There is nothing wrong with that, but this is larger than 1024,<br />and could in certain setups cause problems with:<br />1) software that runs at boot time (e.g., old versions of LILO)<br />2) booting and partitioning software from other OSs<br /> (e.g., DOS FDISK, OS/2 FDISK)<br /><br />Command (m for help): m<br />Command action<br /> a toggle a bootable flag<br /> b edit bsd disklabel<br /> c toggle the dos compatibility flag<br /> d delete a partition<br /> l list known partition types<br /> m print this menu<br /> n add a new partition<br /> o create a new empty DOS partition table<br /> p print the partition table<br /> q quit without saving changes<br /> s create a new empty Sun disklabel<br /> t change a partition's system id<br /> u change display/entry units<br /> v verify the partition table<br /> w write table to disk and exit<br /> x extra functionality (experts only)<br /><br />Command (m for help): p<br /><br />Disk /dev/sdb: 250.0 GB, 250059350016 bytes<br />255 heads, 63 sectors/track, 30401 cylinders<br />Units = cylinders of 16065 * 512 = 8225280 bytes<br /><br /> Device Boot Start End Blocks Id System<br />/dev/sdb1 1 30401 244196001 85 Linux extended<br /><br />Command (m for help): d<br />Selected partition 1<br /><br />Command (m for help): p<br /><br />Disk /dev/sdb: 250.0 GB, 250059350016 bytes<br />255 heads, 63 sectors/track, 30401 cylinders<br />Units = cylinders of 16065 * 512 = 8225280 bytes<br /><br /> Device Boot Start End Blocks Id System<br /><br />Command (m for help): w<br />The partition table has been altered!<br /><br />Calling ioctl() to re-read partition table.<br />Syncing disks.<br />[root@localhost boot]#<br />[root@localhost boot]# fdisk /dev/sdb<br /><br />The number of cylinders for this disk is set to 30401.<br />There is nothing wrong with that, but this is larger than 1024,<br />and could in certain setups cause problems with:<br />1) software that runs at boot time (e.g., old versions of LILO)<br />2) booting and partitioning software from other OSs<br /> (e.g., DOS FDISK, OS/2 FDISK)<br /><br />Command (m for help): m<br />Command action<br /> a toggle a bootable flag<br /> b edit bsd disklabel<br /> c toggle the dos compatibility flag<br /> d delete a partition<br /> l list known partition types<br /> m print this menu<br /> n add a new partition<br /> o create a new empty DOS partition table<br /> p print the partition table<br /> q quit without saving changes<br /> s create a new empty Sun disklabel<br /> t change a partition's system id<br /> u change display/entry units<br /> v verify the partition table<br /> w write table to disk and exit<br /> x extra functionality (experts only)<br /><br />Command (m for help): p<br /><br />Disk /dev/sdb: 250.0 GB, 250059350016 bytes<br />255 heads, 63 sectors/track, 30401 cylinders<br />Units = cylinders of 16065 * 512 = 8225280 bytes<br /><br /> Device Boot Start End Blocks Id System<br /><br />Command (m for help): n<br />Command action<br /> e extended<br /> p primary partition (1-4)<br />p<br />Partition number (1-4): 1<br />First cylinder (1-30401, default 1):<br />Using default value 1<br />Last cylinder or +size or +sizeM or +sizeK (1-30401, default 30401):<br />Using default value 30401<br /><br />Command (m for help): p<br /><br />Disk /dev/sdb: 250.0 GB, 250059350016 bytes<br />255 heads, 63 sectors/track, 30401 cylinders<br />Units = cylinders of 16065 * 512 = 8225280 bytes<br /><br /> Device Boot Start End Blocks Id System<br />/dev/sdb1 1 30401 244196001 83 Linux<br /><br />Command (m for help): w<br />The partition table has been altered!<br /><br />Calling ioctl() to re-read partition table.<br />Syncing disks.<br />[root@localhost boot]# mkfs -t ext3 /dev/sdb1<br />mke2fs 1.39 (29-May-2006)<br />Filesystem label=<br />OS type: Linux<br />Block size=4096 (log=2)<br />Fragment size=4096 (log=2)<br />30539776 inodes, 61049000 blocks<br />3052450 blocks (5.00%) reserved for the super user<br />First data block=0<br />Maximum filesystem blocks=0<br />1864 block groups<br />32768 blocks per group, 32768 fragments per group<br />16384 inodes per group<br />Superblock backups stored on blocks:<br /> 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,<br /> 4096000, 7962624, 11239424, 20480000, 23887872<br /><br />Writing inode tables: done<br />Creating journal (32768 blocks): done<br />Writing superblocks and filesystem accounting information: done<br /><br />This filesystem will be automatically checked every 29 mounts or<br />180 days, whichever comes first. Use tune2fs -c or -i to override.<br />[root@localhost boot]#<br />[root@localhost boot]# cd /mnt<br />[root@localhost mnt]# ls<br />common sdb1 video_ext<br />[root@localhost mnt]# mount -t ext3 /dev/sdb1 /mnt/video_ext<br />[root@localhost mnt]# ls<br />common sdb1 video_ext<br />[root@localhost mnt]# cd video_ext<br />[root@localhost video_ext]# ls<br />lost+found
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
Code:
/dev/sdb1 /mnt/video_ext auto defaults,noexec 0 0
That's just one of many things that you can do to enhance security.
REFERENCES
http://www.linuxquestions.org/questions/linux-general-1/trouble-partioning-and-formatting-new-hard-drive-515018/