I have seen instructions for resizing the partition here, but how do I create a whole new partition using the remaining space, and then mount it?
1 Answer
Using fdisk:
fdisk /dev/sda
Type n to create a new partition.
Type p to make a primary partition.
Next press enter when prompted for a partition number to choose the next available.
Press enter again to pick the next available sector to start the partition. Press enter again to use all of the remaining disk space.
Type w to save the changes.
Fdisk will now exit. You am need to reboot in order for the partition to be available.
You can now make a file system for the new partition using the mkfs command.
mkfs.ext4 /dev/sdax
Where x is the partition number.
Note: sometimes when creating a new partition for the sd card there has been a small amount of logical space that takes up the rest of the image. You'll need to use the method in the question you linked to in order to extend that space, or do as I do and just create another partition after it.
To mount you use the mount command like this:
mount /dev/sdax /path/to/mount/point
If you want the partition to mount automatically at boot then you need to add an entry in the /etc/fstab file.
/dev/sdax /path/to/mount defaults 1 0
-
2On my Pi (Debian squeeze) /dev/sda was /dev/mmcblk0 and x was px, e.g. /dev/mmcblk0p4 Commented Jun 24, 2012 at 17:55
-
That seems to be standard for the RPi distributions for some reason.– JivingsCommented Jun 24, 2012 at 18:09
-
1Ok, the default partitions are created with 16 cylinder gaps. If I accept the first default it creates a 1mb partition in one of the gaps. If I specify the end plus 16 (assuming the gaps are for a reason) then the second default is the end of the unused 2gb. Success, thx Commented Jun 24, 2012 at 19:59
-
I would mount with "defaults,noatime" since it's on an SD card– PaoloCommented Jul 7, 2012 at 20:27
-
1@DavidSykes You should mount with
noatime
as well. This question will explain why.– JivingsCommented Jul 8, 2012 at 15:41