Mount a partition into a folder

Hey everyone!

I have an NTFS partition that serves as a partition I can share files between Endeavour and Windows. I wonder if it would be possible to auto mount that partition during boot and link the folder inside it (“Programming”) to a folder in my Documents folder with the same name (sorry for using folder so much :sweat_smile: ) so that I could access it more easily.

Thanks for the help in advance :slight_smile:

Yes. First mount the folder somewhere by adding an entry to /etc/fstab. Any permanent filesystem location is fine. For the sake of this example I will assume you mounted it at /data.

Once it is mounted, you can symlink the folder you want, like this:

ln -s /data/Programming ~/Documents/Programming

Once you do that, the contents of /data/Programming will appear at ~/Documents/Programming

3 Likes

Thanks! :slight_smile:

Where can I get all the information needed?

Can you share the output of lsblk -o name,type,fstype,size,mountpoint,uuid

1 Like
[xico-endeavour@xico-desktop ~]$ lsblk -o name,type,fstype,size,mountpoint,uuid
NAME        TYPE FSTYPE   SIZE MOUNTPOINT   UUID
nvme0n1     disk        465,8G              
├─nvme0n1p1 part ntfs     579M              FEEC16B3EC166665
├─nvme0n1p2 part ntfs   464,6G              F01C17121C16D406
├─nvme0n1p3 part vfat     100M              6031-A47B
└─nvme0n1p4 part ntfs     554M              C08E6CEA8E6CDA84
nvme1n1     disk        465,8G              
├─nvme1n1p1 part           16M              
├─nvme1n1p2 part vfat     512M /boot/efi    7967-7DC2
├─nvme1n1p3 part swap       8G [SWAP]       bf3f3196-3d12-4b01-82e2-6f877c829af0
├─nvme1n1p4 part ext4     100G /            447360f2-e414-43c0-84bd-d068d77a8826
├─nvme1n1p5 part ntfs      50G /run/media/x 3AF3BA4C31A3E49C
├─nvme1n1p6 part ext4     200G /home        2271f0af-c6e2-420b-80a2-5c51bfd5ac31
└─nvme1n1p7 part ext4   107,2G              93ac3078-f6b2-442b-9cb0-4e3dd81d1563
[xico-endeavour@xico-desktop ~]$

The partition, where the folder is, is nvme1n1p5

Should I just fill in the information in /etc/fstab?

Something like this:

UUID=3AF3BA4C31A3E49C  /data  ntfs-3g   uid=userid,gid=groupid,umask=0022,nofail    0       0

Replace userid and groupid with your actual username.

Be sure that /data or whatever location you choose already exists and is empty.

1 Like

Would it also be possible to mount the disk with the partition Data directly to /home/ to avoid the symlinks?

1 Like

I was going to ask that, if it is possible, it would be better I think… :thinking:

1 Like

Create /home/username/Data (replace username with the actual one)

Use the same fstab line as given above replacing /data with /home/username/Data.

2 Likes

Since I want it to be a Programming folder inside Documents, can I do /home/xico-endeavour/Documents/Programming instead?

Mounting the whole partition like this onto a directory, you will have all the folders residing on that partition when you open that directory, I guess.

If you want only the Programming directory “mapped” onto your /home/xico-endeavour/Documents/Programming, then symlinking as described above by @dalto is the way to go.

2 Likes

Not in this case because he wants a subfolder of the partition in /home

3 Likes

Thank you for clarifying :slight_smile:

This is how it’s looking like in /etc/fstab

UUID=3AF3BA4C31A3E49C  /data  ntfs-3g   uid=xico-endeavour,gid=xico-endeavour,umask=0022,nofail    0       0

/data folder is currently empty, do I need to reboot?

Type sudo mount /data

1 Like

That fixed it, thanks!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.