How to create a new partition in Ubuntu to use free space on harddisk?
During Ubuntu installation I had left some space on hard disk unpartitioned. Later I wanted to use the remaining space as a separate partition mapped to a folder “mywork” inside /home/jayson. Here is what I did to create a new partition and mount it.
First use gparted to create a separate partition out of the free space on the disk. If gparted is not installed use “apt-get install gparted” to get it installed. In gparted I have selected “primary partition” and type as ext3. This type should match the one you will add later in fstab.
sudo apt-get install gparted
Now edit /etc/fstab file using the command “sudo vi /etc/fstab”. Add a line similar to the following,
/dev/sda4 /home/jayson/mywork ext3 defaults 0 0
In the above commands, ensure that you replace /dev/sda4 with the new partition created by gparted and /home/jayson/mywork with an existing folder where you want the partition to be mounted. An entry in fstab ensures that this drive is automatically mounted during bootup.
Run the following command to mount the new partition,
Now you will see that the new partition is available as a folder. But you will not be able to create anything inside it. Use the following commands to give necessary permissions to create files in the new partition.
sudo chgrp -R jayson /home/jayson/mywork
Now your new partition is ready for use!