4

I want to build my own Linux as "Linux From Scratch".

I need to get a new partition from my hard disk. I checked and saw I have sda1. (I have about 20G empty) When I use the fdisk command n, I can only get about 500M space (according to the first and last cylinder fdisk provided me). Why?

Could anyone help me? How can I do this correctly?

Screen shots of my operation:

fdisk output

df output

Kevin
  • 40,767
Anders Lind
  • 2,385

2 Answers2

3

I think rozcietrzewiacz found the main thig that's bothering you. Your call to df is not reporting information about the new partition you created, it's reporting information about the “none” filesystem that's mounted on /dev. This is an in-memory filesystem that exists solely to host device files. You would see the same output from df /dev or df /dev/sda.

df /path/to/file normally reports information about the filesystem containing the specified file; that's what's happening here, because you haven't mounted /dev/sda5. There's an exception: if you supply the path to a mounted device, then df reports information about the filesystem on that device.

There's a second issue: you've apparently run fdisk /dev/sda1. Don't do that, it won't work. You can't create partitions inside partitions that way. (Well, you can, but Linux won't see them.) You need to run fdisk /dev/sda to create partitions on /dev/sda, and apparently you already have partitions there. It's not clear how you want to allocate space on your disk; make sure you know what you're doing if there's other data on the disk that you don't want to lose. Check that your backups are up-to-date!

Feel free to ask for more help on this site. But please copy-paste output as text, not as images (which are hard to read and can't be searched) and provide full session transcripts (e.g. show what command you ran in addition to the output of the command). As a starting point, if you're confused on how to split up your disk, show the output of fdisk -l /dev/sda and explain what the currently existing partitions contain and how you want to reallocate space.

At this point, I recommend reading this answer for background, at least the section about mounting.

Creating a partition defines an area on the disk; it doesn't write anything inside this area. At this point, you should create a partition (type 83) using up most of the disk, and a second partition (type 82) using a couple of GB for swap. On the bigger partition, the second step is to create a filesystem with mkfs.ext2. Once you've done that, you'll be able to mount that filesystem, e.g. with mount /dev/sda1 /mnt.

-1

I've taken a look at the Ubuntu man page for fdisk, in case there was some oddity, I do not see an 'n' switch listed. What about using a Live Distro such as PartedMagic, I'd provide a hyperlink but I am limited to two, which I use below?

You could use GParted and also see a graphical representation of your HDD's partitions. Using GParted you can simply select the 'free-space', size, filesystem type and create the partition (from the back - visually the right side in GParted); or, even create a new partition from the end of an existing one I believe, you cannot split a partition from the front I believe due to technical reasons I had read at one time but cannot recall at the moment.

Below is a link to the official GParted Help Manual:

http://gparted.sourceforge.net/display-doc.php?name=help-manual&lang=C

Here is the section that would apply directly to your needs:

http://gparted.sourceforge.net/display-doc.php?name=help-manual&lang=C#gparted-intermediate-partition-actions

That is the 'Intermediate Partition Actions' section. As you can see, the first subsection is 'Creating a New Partition'. It will guide you through step-by-step.

V_P
  • 169