Organize File System Defaults [SOLVED]

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
rgand
Level 5
Level 5
Posts: 536
Joined: Fri Feb 05, 2016 12:44 am

Organize File System Defaults [SOLVED]

Post by rgand »

So, now I have a dual boot with 18.1 Cinnamon on one drive (sda) and 18.2 Cinnamon on a second (sdb). I'm finding that I use the data partition I created on sdb for all my files. That leaves 'Documents', 'Music', 'Pictures', 'Videos' and 'Downlloads' totally unused, other than being the defaults which I have to remember to switch from when I save things.

Is there any way I can designate those to point to the corresponding parts of the data partition on sdb? For example, can I have a 'Pictures' folder on the data partition that is read when I click on the 'Pictures' option under 'My Computer'?

Thanks for any help on this. RG
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Smile, it makes people wonder what you've been up to.
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: Organize File System Defaults

Post by xenopeek »

You can do this with symbolic links or with bind mounts.

First things first, for both options you must have the data partition mounted already. So I'm assuming you already have set up a mount point, say /data, and mounted your data partition on that in /etc/fstab.

Now say you want to use a symbolic link to point /home/rgand/Videos to /data/Videos. First you have to delete the Videos directory in your home directory. Then create the symbolic link with this command: ln -s /data/Videos /home/rgand/Videos. This creates a new directory Videos in your home directory which is actually a link to /data/Videos. In your file browser you can see this is a link to another file or directory though. This is the easiest way and it is flexible.

Alternative is to use a bind mount. To achieve the same thing as the symbolic link you would add this line to your /etc/fstab file (after the line to mount your data partition on /data): /data/Videos /home/rgand/Videos none bind. For this you don't need to remove the Videos directory from your home directory. The bind mount will effectively hide the contents of the Videos directory in your home directory and replace it with the contents of the /data/Videos directory. In your file manager this makes Videos indistinguishable from other directories. But a bit more work that symbolic links.

If you want to go with a bind mount I strongly urge you to test it out before you commit changes in /etc/fstab. For example run sudo mount --bind /data/Videos /home/rgand/Videos to set up the bind mount from above example. This isn't permanent; if you did something wrong you can just reboot and the bind mount will be undo. Or use sudo umount /home/rgand/Videos to undo the bind mount.

Note: in all examples replace "rgand" in /home/rgand/... with your actual username on your system :wink:
Image
User avatar
rgand
Level 5
Level 5
Posts: 536
Joined: Fri Feb 05, 2016 12:44 am

Re: Organize File System Defaults

Post by rgand »

xenopeek wrote:First things first, for both options you must have the data partition mounted already. So I'm assuming you already have set up a mount point, say /data, and mounted your data partition on that in /etc/fstab.
I obviously didn't have this so I went back to the tutorial on how to create and use a separate DATA partition:
https://community.linuxmint.com/tutorial/view/1609

This is all kind of beyond me so I just blindly followed the instructions and got this far:
Find out the UUID# for your data partition:

sudo blkid
and found that I have 6 different UUID#'s

Code: Select all

/dev/sda1: UUID="A67F-1C75" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="6b536be6-cf54-4f83-bdad-eb45b3ec2282"
/dev/sda2: UUID="e87286e3-7918-465e-9103-33292391040e" TYPE="ext4" PARTUUID="797ad6fb-7259-47ee-8ec1-811ca1e30427"
/dev/sda3: UUID="17be6734-cdce-4f8c-bbf9-4941e6bc38f8" TYPE="swap" PARTUUID="0c6a4ec5-8a82-4910-b421-47a4badab24a"
/dev/sdb1: UUID="9F88-B7A0" TYPE="vfat" PARTUUID="55c9806b-6f97-4f84-bb2f-5a8193f25719"
/dev/sdb2: UUID="5dfd7a22-0adb-48c8-873a-1b0257ed6426" TYPE="ext4" PARTUUID="926c5a4b-a86d-4ff1-94aa-c15605a19fcc"
/dev/sdb3: LABEL="Data" UUID="594e2577-9f2d-4e10-980c-b6a1c4eefdb8" TYPE="ext4" PARTUUID="6427a946-fd31-47d1-9120-51b1de7211cb"
/dev/sdb5: UUID="9ff62711-5ab8-425b-91bd-bcac22095618" TYPE="swap" PARTUUID="edbf9c11-6f44-4a03-8e17-0f6f4970da68"
I expect that I use the one for /dev/sdb3, which is my data partition.

I did find that once the partition was mounted (temporarily at this point) I could see the contents of the Data partition in the /mnt/DATA folder (the one I chose to make for this). Am I on the right track here? I hesitate to proceed and ignorantly mess something up. Thanks, RG.
Smile, it makes people wonder what you've been up to.
User avatar
rgand
Level 5
Level 5
Posts: 536
Joined: Fri Feb 05, 2016 12:44 am

Re: Organize File System Defaults

Post by rgand »

xenopeek wrote:Alternative is to use a bind mount. To achieve the same thing as the symbolic link you would add this line to your /etc/fstab file (after the line to mount your data partition on /data): /data/Videos /home/rgand/Videos none bind. For this you don't need to remove the Videos directory from your home directory. The bind mount will effectively hide the contents of the Videos directory in your home directory and replace it with the contents of the /data/Videos directory. In your file manager this makes Videos indistinguishable from other directories. But a bit more work that symbolic links.
I went with this method and did it with the backup installation of mint 18.2 on the second drive. It worked great.
xenopeek wrote:If you want to go with a bind mount I strongly urge you to test it out before you commit changes in /etc/fstab. For example run sudo mount --bind /data/Videos /home/rgand/Videos to set up the bind mount from above example. This isn't permanent; if you did something wrong you can just reboot and the bind mount will be undo. Or use sudo umount /home/rgand/Videos to undo the bind mount.
Thanks for this pearl of wisdom. It took me 6 tries before I found the right coding.

With that done, I then created a second login on the same installation to see what differences were needed. Not much was different but like all computer stuff, one character can make a significant difference. Both those logins work as expected.

I have most of the main boot installation of 18.2 done but need to organize a few files before finishing up. I expect everything to be clean and operating up to the level of the other installation in short order. Many thanks, you really helped me get this done right. I'm starting to learn how to think in the Linux environment but it's totally different than anything I've done before. I appreciate your guidance without which I may not have got it done or messed it up for fair.
Smile, it makes people wonder what you've been up to.
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: Organize File System Defaults

Post by xenopeek »

Thanks :)
Image
Locked

Return to “Storage”