Specifying a custom mount point for an empty partition

5,150

Solution 1

=== EDIT STARTS ===

I am assuming you want it to be mounted every time you boot, if what you want is to mount it one time:

$ sudo mkdir /data-part
$ sudo mount /dev/sdaX /data-part

should do the trick.

=== EDIT ENDS ===

Sure you can. First you need to know device file of the partition you need to mount (it should be something like sda* in most cases). If you don't know, install and run gparted and find out device file of the partition.

gparted

Once you find the device file, fire up your favorite editor from terminal (assuming device file you want to mount is /dev/sdaX, replace accordingly):

$ sudo gedit /etc/fstab

When editor opens, go to the bottom of the file and add a line like:

/dev/sdaX /data-part ext4 defaults 0 0

And then, all you need to do is to create a directory at mount point:

$ sudo mkdir /data-part

After your next reboot, partition should be mounted at the mount point automatically.

Solution 2

Try running these commands:

sudo mkdir -p /data-part
sudo mount -t ext4 /dev/sdb1 /data-part

This will do the trick.

Share:
5,150

Related videos on Youtube

b-ak
Author by

b-ak

Updated on September 18, 2022

Comments

  • b-ak
    b-ak over 1 year

    I have ubuntu 12.04 running on my system. I repartitioned my hard disk yesterday, I have an empty 40GiB partiton.

    Can I mount it at say /data-part ? How do I do this ?

    I have formatted it as ext4.

  • b-ak
    b-ak over 11 years
    Awesome, This will be first thing I'll do once I get back home.. Yes I want it to be mouted automatically everytime... So this is how partitions are handled in Linux ?? Is this like Windows' D:/, E:/ etc.,
  • Gokhan Sari
    Gokhan Sari over 11 years
    Yes, you can mount a partition to directory you want. What I can suggest is that, instead of mounting partitions in random places, you shall keep mounted directories in a specific folder. For example, I am keeping them in /media folder (like /media/storage /media/backup).