Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 507  / 3 Years ago, sun, september 26, 2021, 1:30:13

I am still newbie to ubuntu.



I have a partition (ext4) with all my Documents and Photos, etc. This partition doesn't have any mount point. I want to use Document folder from this partition as my Document folder in Home directory.



I see few possibilities, somehow to mount this partition on booting (and not when I click on it in Folder Manager) and create symbol link from my /home/Documents to /media/partition/Documents or just mount all partition as /home/Document.



It seems like the first solution is cleaner, however the problem is I don't really understand how to mount partition on booting to constant media folder.



What's is the right way to do so?


More From » 12.04

 Answers
3

First, copy everything you have in your current (Home folder) Documents folder over to that partition.

Second, I'm going to assume that there is a folder called "Documents" in that partition.




  1. sudo umount /dev/sda3




    • This is to unmount the partition if it's already mounted.


  2. sudo mkdir /media/partition




    • This will create our mount point.


  3. sudo cp /etc/fstab /etc/fstab.bak




    • This will take a backup copy of the file we're going to edit.


  4. sudo nano /etc/fstab. This will open up the file in a text editor. Navigate to the end of the file, and paste the following two lines (paste by Ctrl+Shift+V):



    #automounting the sda3 partition to use for Documents
    /dev/sda3 /media/partition ext4 defaults 0 2


    When done, hit Ctrl+X, then Y, then Enter to save and close.




    • The second line ensures that sda3 is always mounted to /media/partition. The defaults option is the one responsible for auto-mounting, amongst other things. Read more here: Fstab - Community Ubuntu Documentation.




    A more robust method would be to replace /dev/sda3 with UUID=<randomnumbers> in the second line, that's why I asked you for the output of sudo blkid in the comments.



  5. sudo mount -a




    • This will make our changes to fstab take effect. If you get errors here, stop!


  6. cd ~ && rm -r Documents




    • This will delete the Documents directory in your Home folder.


  7. cd ~ && ln -s /media/partition/Documents




    • This will create a symbolic link to that Documents folder in the partition.


  8. At this point, you're done. However, you'll probably notice that your Documents folder has lost it's properties, and looks like this: and not like this . To fix this, do nano ~/.config/user-dirs.dirs and re-add the path to Documents in its respective line:



     XDG_DOCUMENTS_DIR="$HOME/Documents"


    Ctrl+X, then Y, then Enter to save and close. Re-open Nautilus (your file manager) and you should be set.


  9. Test by rebooting your machine.




Since you've mentioned that you also have Pictures(, etc.) on that partition, you can repeat steps 6, 7 and 8 to create their symbolic links, but remember to backup whatever is in the current folders.


[#30149] Tuesday, September 28, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
atereress

Total Points: 79
Total Questions: 106
Total Answers: 119

Location: Federated States of Micronesia
Member since Sun, May 16, 2021
3 Years ago
;