Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm running ubuntu drake and kinda messed up the partitioning of a second hard drive when recently installing ubuntu. Rather than reinstalling the system I'm trying to figure out how to do it using fdisk, any help would be great.
The drive is 40G in size and is at /dev/hdb. I'm not even sure how to about installing fdisk (does it come preinstalled) and the command I would need to run, though I dont think it would be difficult, I'm looking for a simple 'ext3' single primary drive mounted to say..... /media/home
Well, fdisk should already be installed. Run "whereis fdisk" to make sure (it will probably be in /sbin or similar). I'm not exactly sure what you are trying to do though. So you have two hard drives: /dev/hda for Ubuntu that is already installed and /dev/hdb that you want to make a single ext3 partition? Is that right?
Yeah so when I install ubuntu I installed it on hda but had a second hard drive which I messed up and patitioned as an 'extended partition' and so cant get to it within ubuntu, so I want to repartition it as a primary drive mounted at /media/home
Okay, thats no problem. As long as your hard drive is connected correctly you should be able to run
Code:
fdisk /dev/hdb
to enter the fdisk environment. You can use "p" (thats just p on a line by itself) to list the current setup on that drive. The first thing you will want to do is use "d" to delete the existing partitions. Then you will want to use "n" to create a new partition using the default starting and ending blocks. This will give you one partition that consumes the entire drive. Once created you will need to use "t" to change the ID for that partition. You can use "l" to list all the available IDs. It will probably default to the correct ID though, 83. When you are done you can use "w" to write the changes to your disc. I simiulated the process on my pc so here it is:
Code:
root@marXubuntu:~# fdisk /dev/hda
The number of cylinders for this disk is set to 4864.
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/hda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 65 522081 83 Linux
/dev/hda2 66 4733 37495710 83 Linux
/dev/hda3 4734 4864 1052257+ 82 Linux swap / Solaris
Command (m for help): d
Partition number (1-4): 1
Command (m for help): d
Partition number (1-4): 2
Command (m for help): d
Selected partition 3
Command (m for help): p
Disk /dev/hda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 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-4864, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-4864, default 4864):
Using default value 4864
Command (m for help): p
Disk /dev/hda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 4864 39070048+ 83 Linux
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): l
0 Empty 1e Hidden W95 FAT1 80 Old Minix be Solaris boot
1 FAT12 24 NEC DOS 81 Minix / old Lin bf Solaris
2 XENIX root 39 Plan 9 82 Linux swap / So c1 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
5 Extended 41 PPC PReP Boot 85 Linux extended c7 Syrinx
6 FAT16 42 SFS 86 NTFS volume set da Non-FS data
7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set db CP/M / CTOS / .
8 AIX 4e QNX4.x 2nd part 88 Linux plaintext de Dell Utility
9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM df BootIt
a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e1 DOS access
b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O
c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS e4 SpeedStor
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs
f W95 Ext'd (LBA) 54 OnTrackDM6 a5 FreeBSD ee EFI GPT
10 OPUS 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/
11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b
12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f1 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor a9 NetBSD f4 SpeedStor
16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot f2 DOS secondary
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fd Linux raid auto
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fe LANstep
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid ff BBT
1c Hidden W95 FAT3 75 PC/IX
Hex code (type L to list codes): 83
Command (m for help): p
Disk /dev/hda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 4864 39070048+ 83 Linux
Command (m for help):
keep in mind that you will use "/dev/hdb" instead of "/dev/hdb"
Once the partition is in place you will need to use mke2fs to format the partiton. Run
Code:
mke2fs -j /dev/hdb1
Once the partition is in place you will need to add a line to your /etc/fstab that will automatically mount this drive when you boot. Add the follwing line (or something similar):
this was very helpful, i tried to dd an image of mac os to a spare hard drive to try to get it to work, but it failed misrably (i had a .iso instead of a .img) i have a hard drive with mandriva and xp, a hard drive with just data, and that spare hard drive, i wanted to install slack on the spare but the slack installation wasn't seeing the hard drive, now that i formatted it into a linux partition, it worked, thanks
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.