Peppermint OS Community Forum

Resources => User Submitted Tutorials => Topic started by: Slim.Fatz on May 17, 2015, 06:35:00 am

Title: How To: Use symlinks to a DATA partition
Post by: Slim.Fatz on May 17, 2015, 06:35:00 am
INTRODUCTION

This is a tutorial that can be used for Peppermint 10 or also the previous versions Peppermint 9, Peppermint 8, Peppermint 7 and Peppermint Six. It is for those who wish to set up their HDD or SSD in a manner that makes it easier to perform several different tasks. Tasks such as:

This tutorial involves use of the command line interface (CLI) but is still easy for inexperienced users to follow and perform. Note that I use the terms "folder" and "directory" interchangeably (i.e. as synonyms). I also use the terms "CLI window", "terminal" and "terminal window" interchangeably.

The main idea behind this tutorial is to have all of your personal files (meaning: your documents, photos, music, videos, etc. but not the operating system itself) located on a partition that is separate from the partition(s) used for a typical installation of PeppermintOS. In the remainder of this tutorial I will refer to this separate partition with your personal files as the DATA partition.

To make access to this DATA partition as automatic and transparent as possible we will make use of "symbolic links" -- often also called "soft links" or "symlinks". If you desire more details about symlinks you can refer later to the following informational page that is relatively easy to understand, but unnecessary to complete this tutorial:

http://www.nixtutor.com/freebsd/understanding-symbolic-links/ (http://)

Note: This tutorial and any changes or deviations from the steps given in this tutorial are done at your own risk. If in doubt or unsure about anything, post your questions here on the Peppermint Forum before doing anything that you might regret. In other words: Look before you leap !!!

Enough said. Let's get started!



SET UP THE PARTITION(S)

I set up my HDD with a / partition (also known as the root partition), where the "distro-specific" files are found, a swap partition (mine is about 2 GB large), and (in an extended partition) a very large partition for storing my personal files (this is the DATA partition). My / partition is about 20 GB in size and the DATA partition is about 250 GB large (I don't have many large video files  ;D ).

Of course there are other possible partitioning schemes you can follow, if you are unsure just post your question on this forum.

If you have already installed PeppermintOS then this DATA partition is one that you must create. It is easy using the Gparted program while running the PeppermintOS live CD or USB (since it is very important that your installation of PeppermintOS is not mounted should you need to make it smaller so that the new DATA partition can be nice and big).

After shrinking your PeppermintOS installation (if necessary) and creating your big new DATA partition (format it as you wish, I use ext4, but you can select ext3, or whatever you prefer and understand), and giving it the label DATA (you can name it something else if you wish) be sure to make a note of where the DATA partition is located. In my setup the DATA partition is the partition known as "device sda5" (its "location") which is written as

/dev/sda5

After noting this information (in this example you would write down

/dev/sda5

somewhere so that you can use it later in this tutorial), you perform the remaining steps while running your installed PeppermintOS.



CREATE THE MOUNT POINT

After booting your installed PeppermintOS and logging into it you will create your mount point for the DATA partition using the following steps:

1. Open your file manager (e.g. Nemo)

2. In the file manager go to the folder /mnt

3. When you have opened the folder /mnt press the F4 key on your keyboard to open a CLI window in this folder.

4. Enter the following command into the terminal window that has opened (Note: Linux is case sensitive! This means that a command like sudo must be typed exactly that way -- Sudo will not work! Neither will MkDir work -- it must be mkdir):

Code: [Select]
sudo mkdir DATA
Hit the Enter key and then type in your user password when asked (Note: your password is entered invisibly. You will not see it. You may enter an incorrect password 3 times before you have to repeat the action you are trying to execute).

5. When you have completed step 4 successfully, enter the following command in the same terminal window:

Code: [Select]
whoami
Press the Enter key and you will see your username printed in the CLI window (just in case you did not know your username already). We will use this username in the next command.

6. After completing step 5, you now enter into the same CLI window (substituting your actual username for "username" in the following command):

Code: [Select]
sudo chown -R username:username DATA
(Note: do not forget the colon : that is inserted between the two occurrences of your username) Hit the Enter key and then type in your user password if asked. The chown command has given you "ownership" of the DATA directory (where the DATA partition will be mounted). Before running that chown command, root was the "owner" and only root would have been permitted to write and delete files there. Not very handy for storing your personal files! But now, since you "own" it, you can do anything there you desire.



MAKE THE DATA PARTITION AVAILABLE FOR USE

Having successfully created the /mnt/DATA mount point you now need to modify the system's file named fstab (found in the folder /etc in the / partition of PeppermintOS). This modification is required so that the DATA partition will always be "mounted" and ready to be used when you log in to PeppermintOS. To do this, use these steps:

1. Open a CLI window (e.g. press the 3 keys Ctrl, Alt and t in the following manner: press and hold down the key Ctrl; while pressing Ctrl now also press and hold down the key Alt; and while pressing those two keys press briefly the key t. This is normally written in the shorthand form as either Ctrl + Alt + t or <Ctrl><Alt><t>, and it will open a CLI window for you).

2. Enter the following command into the CLI window (insert the name of your installed text editor, such as xed or gedit or pluma):

Code: [Select]
sudo xed
Hit the Enter key and then type in your user password if asked.

3. When xed starts, open the file fstab, that you will find in the directory /etc.

4. At the end of the fstab file add the following lines:

Code: [Select]
# DATA partition /dev/sda5 is at /mnt/DATA ...
/dev/sda5   /mnt/DATA   ext4   noatime,defaults   0  0

Note that there is no space between noatime, and defaults! At the end of the second line are the numbers zero, not the letters O. Here you will also perhaps need to replace what I have written as

/dev/sda5

with your actual device name (hopefully you noted it above) where the DATA partition is located. It could be on a different HDD device, such as

/dev/sdb2

Also, if your DATA partition has been formatted to something other than ext4, you must change that in the fstab entry as well. The first line that I listed above (that starts with #) is not really needed (it is just a comment for you to see when you look at this file maybe 2 months later and ask yourself what was I doing here?  :-\ )...

5. After adding the appropriate entry in the file fstab, save the file and close the text editor.

6. To be sure that things are working properly, we will continue in the open CLI window (or, if you have already closed it, open a new one with Ctrl + Alt + t) and enter the command:

Code: [Select]
sudo mount -a
Press the Enter key. If asked, enter your password and press the Enter key again. This command has simply mounted all partitions mentioned in your fstab file, including now the new DATA partition. Now enter the following command in the terminal window:

Code: [Select]
mount
Press the Enter key and examine the output. In the output lines you should be able to see (using the example above) a line that reads pretty much like this:

/dev/sda5 on /mnt/DATA type ext4 (rw,noatime,data=ordered)

If this appears, then the DATA partition is mounted and ready to be used!  8)



MOVE YOUR PERSONAL FILES TO THE DATA PARTITION

In my /mnt/DATA I have created several folders that are named Documents, Videos, Pictures and Music. This can be easily done from within your file manager. Just start the file manager and navigate to

/mnt/DATA

When you are there, "right click" in the opened directory window to get a pop-up menu, where you then select "Create New..." -> "Folder" and then give the new folder a name (such as Videos).

Back in your "home" folder

/home/user_name

(substitute your actual user_name, of course) you should move (not copy, but MOVE) with "cut" and then (in the corresponding folder in the DATA partition) "paste" all of your personal files over to the appropriate folders in the DATA partition: for example, move all files in

/home/user_name/Documents

into

/mnt/DATA/Documents

Do this for all other personal files in the remaining folders, such as:

/home/user_name/Music into /mnt/DATA/Music

/home/user_name/Pictures into /mnt/DATA/Pictures

/home/user_name/Videos into /mnt/DATA/Videos

/home/user_name/Downloads into /mnt/DATA/Downloads

/home/user_name/Public into /mnt/DATA/Public

/home/user_name/Templates into /mnt/DATA/Templates

When this has been completed, you should have all of your personal files in your DATA partition and its folders (i.e. the files are no longer physically in your /home/user_name partition).



CREATE SYMLINKS TO YOUR DATA PARTITION

After all personal files have been moved to the DATA partition, you can start to replace each of the (now empty) folders named Documents, Videos, Pictures, Music, etc. in your

/home/user_name

folder with symlinks to the similarly named folders in /mnt/DATA. Do this as follows (and for each folder):

1. Open your file manager and display your

/home/user_name

folder.

2. Double check that your folder to be replaced (e.g. Documents) in the folder

/home/user_name

is really empty! If it is empty, return to the folder

/home/user_name

2. Delete the empty folder Documents that you see in

/home/user_name

In your file manager, the folder Documents should no longer be visible in the folder

/home/user_name

3.  When in your /home/user_name folder press the F4 key on your keyboard to open a CLI window.

4. In the CLI window enter the following command to create a symlink to your personal files in the DATA partition:

Code: [Select]
ln -s /mnt/DATA/Documents Documents
and press the Enter key. In your file manager you should now see a folder icon with the name Documents and it should have a little "arrow" in one corner (indicating that this is a symlink).

5. "Left click" on the symlink you just created and the file manager should display all of your personal files that you previously moved to

/mnt/DATA/Documents

Now repeat steps 1-5 above for each of the other folders in your

/home/user_name

folder that you have previously emptied of personal files (Music, Videos, etc.). Of course, replace the folder name "Documents" with the appropriate folder name for your next symlink (e.g. Videos).

When you are finished your

/home/user_name

folder looks basically identical to the original, just the folders that are named Documents, Vidoes, Pictures, Music etc. are now symlinks to the actual folders in

/mnt/DATA

Now you just click on one of these "symlink" folders in your "home" folder

Code: [Select]
/home/user_name

and you are automatically shown the contents of the corresponding folder in

Code: [Select]
/mnt/DATA

without having to go there! Adding new files, deleting old ones, etc. within these "symlink" folders in your "home" folder can all be done as before, only everything is now actually occurring in the new folders in the DATA partition and only "appears" to be occurring in your "home" folder. The advantages, I hope, are clear.  ;)

This concludes the work you need to do in this tutorial.



CONCLUDING REMARKS

The advantage to this, as I see and have experienced it so far: When you decide to install a new distro, or new distro version, over the old one, all that you need to do is reformat the / partition (and the /home partition, if you had a separate one) and install over them. Any old and potentially disruptive config files that might have been present in those partitions are now gone (and will be replaced by the new config files of the new installation); however, your personal files in the DATA partition are left untouched! The destruction of the symlinks only destroys the symlinks but not your folders and files on the DATA partition! Of course, you still must recreate the mount point DATA in the directory

/mnt

of the new installation, modify the file

/etc/fstab

as shown above (I always keep a backup of this file in my DATA partition for reference) and make the new symlinks in your fresh

/home/user_name

folder as shown above -- but those few steps are all done relatively quickly compared to backing up all of your personal files, and then later copying them all back to your new installation.

There are other alternatives to this tutorial, for example: using a partition-cloning and -imaging program (like the one AndyInMokum uses -- Clonezilla, as I recall) to backup your personal files -- something that you should probably do anyway in case the HDD with your DATA partition fails! You might wish to read the forum messages from AndyInMokum about this before finally deciding what to do.

An additional note here is that this tutorial is primarily intended for those people using PeppermintOS !! I have not tested it with every possible Linux distro and cannot promise that things will work for any distro other than PeppermintOS. For example, if you use multiple Linux distros to access your DATA partition, there can be problems whose solutions go beyond the goal of this tutorial and are not so easy for inexperienced users to solve. One example of this (although it is thankfully not very common) is if one of your other Linux distros assigns a GUID that is not 1000 (such is the case with the Linux distro PCLOS). To see how you can get around the resulting problems see this forum message (https://forum.peppermintos.com/index.php/topic,1835.msg40662.html#msg40662) by unclebaldie and the one by PCNetSpec that follows it. Thank you, unclebaldie, for bringing up this problem (that I have also had with a different Linux distro -- but I have forgotten which one it was  ::) ) and for showing how it can be solved.

I welcome any comments about and corrections to this tutorial.

In closing, I must say that whatever you think looks easiest for you to do is probably the way to go.

Regards,

-- Slim
Title: Re: How To: Use symlinks to a DATA partition
Post by: rmcellig on June 12, 2015, 04:47:45 am
I'm going to try this. Excellent tutorial!!!

Thanks Slim!
Title: Re: How To: Use symlinks to a DATA partition
Post by: Slim.Fatz on June 12, 2015, 04:54:12 am
Hi rmcellig,


You are welcome! If you have any questions or problems, you know where to come for help!!  8)


Regards,


-- Slim

Title: Re: How To: Use symlinks to a DATA partition
Post by: Brotherred on August 15, 2015, 09:22:58 pm
Before my most recent install of Pep6, I should have thought to copy my /wine to my /data. If I had done that I would not have had to reinstall all of my of the plug-ins or extensions that go with my Wine applications! E-sword Bible software is one that I have known in the past to easily handle copy and paste or using an old directory and a new install.


My /data drive configuration also is messy. Some how it has always been with Peppermint that my /mnt/data is the label and it is mounted on /media/data. This is the way it is from install time.

Regards
Title: Re: How To: Use symlinks to a DATA partition
Post by: Slim.Fatz on June 25, 2016, 03:57:00 am
Hi interested readers,

I have done a few cosmetic changes and little updates (related to Peppermint Seven) in the original posting (first message in this thread). I hope you can benefit from this tutorial -- so many people find that it saves them a lot of time and effort when updating, re-installing or adding other distros to test or play around while maintaining access to all of their personal data files.  ;)

As always, if you have any questions then ask back here in the forum and one of us will gladly help you.  8)
Regards,

-- Slim
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on June 26, 2016, 01:10:24 pm
Thanks for the update Slim .. this is a great tutorial :)
Title: Re: How To: Use symlinks to a DATA partition
Post by: Slim.Fatz on June 26, 2016, 01:45:32 pm
Hi PCNetSpec,

You're more than welcome, mate. And thank you very much for the accolades *blushing*  :)

Regards,

-- Slim
Title: Re: How To: Use symlinks to a DATA partition
Post by: Bigoeuf on June 27, 2016, 04:53:43 am
Yes echo what Mark said - excellent tutorial -  just done a full install of Pepp 7 x64 so it was a good opertunity to do this - went sweet as a nut - the only minor hiccup was in the MAKE THE DATA PARTITION AVAILABLE FOR USE section paragraph 6. I had to reboot & not just logout & log back in again So cheers again Slim  :D
Title: Re: How To: Use symlinks to a DATA partition
Post by: AndyInMokum on June 27, 2016, 06:05:31 am
This is a really important tutorial.  Setting up a /DATA partition makes life with Linux much easier and add so much flexibility to the system.  As a community, we need to point it out more often to newbies and upgraders.  Thanks Slim for the PM7 edits  ;).
Title: Re: How To: Use symlinks to a DATA partition
Post by: Timo on June 27, 2016, 07:15:20 am
As a community, we need to point it out more often to newbies and upgraders.

Yes, absolutly. Everyone with multiple OS or HDDs should know this. Great tutorial Slim!
Title: Re: How To: Use symlinks to a DATA partition
Post by: Slim.Fatz on June 27, 2016, 08:38:02 am
@Bigouef:

Thanks for the kind words and the info concerning your need to reboot. I have corrected this postion of the tutorial (it is not necessary to reboot and I should have had this in the original version  ::) ). But at least now it is there.  8)

@Timo and AndyInMokum:

Thank you very much, mates! I really appreciate your words.

Regards,

-- Slim
Title: Re: How To: Use symlinks to a DATA partition
Post by: donwatson on June 27, 2016, 06:09:31 pm
I am going to try this. Will need to have a good read through it first  :-\
Title: Re: How To: Use symlinks to a DATA partition
Post by: AndyInMokum on June 27, 2016, 06:17:33 pm
I am going to try this. Will need to have a good read through it first  :-\
This is a great idea and a very nice practical project to do  ;).   After you've done it once or twice, you'll realize how easy it is to do.  It makes life really simple when it come to upgrading, or if you fancy a bit of distro hopping.  Just be sure you back up your critical data before you actually do it.  Also, when in doubt - ask  ;).
Title: Re: How To: Use symlinks to a DATA partition
Post by: Slim.Fatz on August 02, 2016, 04:50:45 am
Hi everyone,

Just to let you know: I have made some small updates and changed a few lines of the original (first) tutorial post to (hopefully) make it easier and more understandable for those new to the concept and interested in giving it a try.

Regards,

-- Slim
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on August 02, 2016, 06:18:52 am
Nice .. Cheers Slim :)
Title: Re: How To: Use symlinks to a DATA partition
Post by: unclebaldie on August 02, 2016, 10:23:12 am
Hi all,

Many thanks for that very useful tutorial. Just another example of how brilliant PM7 is.
Could I just clarify (sorry if I am being a bit thick here!): :-\
If I have, say, PM7 on sda1, another distro on sda2, and a DATA partition on sda3,
then providing I use the same username on both distros, I would be able to read/write to this DATA on both distros ?
And all the hidden files, configs, etc, would remain on the respective distros HOME folder.
Sorry for asking, but I just want to be clear before I set this up !

Many thanks,
Phil
Title: Re: How To: Use symlinks to a DATA partition
Post by: Slim.Fatz on August 02, 2016, 11:40:06 am
Hi unclebaldie,

Yes, that should work just fine. I do that now (accessing the same DATA partition when using different Linux distros). And you are correct: the config files and hidden files and hidden directories remain on the respective distro home folders.

Regards,

-- Slim
Title: Re: How To: Use symlinks to a DATA partition
Post by: unclebaldie on August 02, 2016, 01:42:26 pm
Whoohoo,
Thanks, Slim ! ;D
I am currently running PM7, Sparky4.3 and Linux Mint Rosa 17.3. (My favourite is, obviously, PM7 !).
And it was a pain in the proverbial to keep the home folders in sync.
Your tutorial has solved my problem.

Many thanks,
Phil
Title: Re: How To: Use symlinks to a DATA partition
Post by: Slim.Fatz on August 02, 2016, 02:49:02 pm
Hi unclebaldie,

You are very welcome! And I'm very happy to hear that this is working for you and makes your work easier!  8)

Regards,

-- Slim
Title: Re: How To: Use symlinks to a DATA partition
Post by: unclebaldie on August 07, 2016, 06:19:29 pm
Hi Slim,

I have encountered an issue that I think needs mentioning (if no-one has already).

My harddisk has 4 distros installed, plus the DATA partition:
sda1 - Peppermint 7
sda2 - Sparky Linux
sda3 - DATA partition
sda5 - swap
sda6 - AntiX MX15
sda7 - PCLinuxOS

When I first setup the DATA partition, I changed ownership to my login name - phil
Fine, I have read/write access to DATA on Peppermint7, Sparky and Antix.
However I setup the PCLOS distro with access to DATA., and rebooted.
I find that I now have only read access to DATA.

It seems that when you create your user in PM7, Sparky and Antix (and I guess many other distros), the username (in my case phil) is allocated a UserID/GroupID of 1000. So I have full access on those distros (because the same UserID/GroupID number).

But PCLOS allocates a UserID/GroupID of 500, so not full access. So I had to change the UserID/GroupID on PCLOS to 1000. Once that is done, it gives me full access..

I don't whether any of this makes sense to you.  :-\
But just thought that I would mention this as a caveat. Make sure that your user has the same User/GroupID on the distros that you want to access DATA.

Hope that this helps,

Phil
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on August 07, 2016, 09:21:29 pm
Makes perfect sense to me .. most distros now use GUID 1000 for the first account but there are a few that don't (usually 500).

Your options are to

a) change GUID in PCLOS (as you did)

b) mount the DATA partition with a user/group permission mask in PCLOS
Title: Re: How To: Use symlinks to a DATA partition
Post by: AndyInMokum on August 07, 2016, 09:32:47 pm
That's well spotted  ;).  I also have a multiboot system.  Fortunately, all my distros allocate a UserID/GroupID of 1000.  This UserID/GroupID variance with some distros, does need to be mentioned in the tutorial as a footnote.  Along with the solutions.
Title: Re: How To: Use symlinks to a DATA partition
Post by: Slim.Fatz on August 08, 2016, 12:43:56 pm
Hi everyone,

I have made a few additions at the end of the Concluding Remarks part of the tutorial that address the issue (described in this forum posting (https://forum.peppermintos.com/index.php/topic,1835.msg40662.html#msg40662)) brought up by unclebaldie (and solved by him and PCNetSpec) that can, in certain constellations of multiboot systems where all installed distros are trying to use the DATA partition, result in access permission trouble -- fortunately this problem is rather rare and can be solved.

Thank you, unclebaldie and PCNetSpec.  8)

Regards,

-- Slim
Title: Re: How To: Use symlinks to a DATA partition
Post by: unclebaldie on August 08, 2016, 01:22:37 pm
Thanks, Slim, for adding the warning to your excellent tutorial.
I had to search for how to change the userid - it involves a bit more than just changing the number.
You have to recursively change ownership of all your files.
The following links explain a quick way to do it:
https://muffinresearch.co.uk/linux-changing-uids-and-gids-for-user/ (https://muffinresearch.co.uk/linux-changing-uids-and-gids-for-user/)
or here:
http://www.cyberciti.biz/faq/linux-change-user-group-uid-gid-for-all-owned-files/ (http://www.cyberciti.biz/faq/linux-change-user-group-uid-gid-for-all-owned-files/)
Watch your spacing !

Anyway, my shared DATA is working fine on all my distros now - sweet! Thank you, Slim and Peppermint !!!!! :)

Phil
Title: Re: How To: Use symlinks to a DATA partition
Post by: alynur on August 17, 2016, 02:20:49 pm
Hi Slim.Fatz, There is something I just don't understand. If I shrink my current root partition and create a DATA partition out of all the available space created, would I make the mount point /mnt or /DATA? And then label it DATA?
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on August 17, 2016, 04:30:00 pm
You don't have to mount it at all as you create the partition.

You'll mount it later at say /mnt/DATA or /media/DATA via an entry you'll add to /etc/fstab (after first creating that directory)
Title: Re: How To: Use symlinks to a DATA partition
Post by: alynur on August 17, 2016, 05:07:22 pm
You don't have to mount it at all as you create the partition.

You'll mount it later at say /mnt/DATA or /media/DATA via an entry you'll add to /etc/fstab (after first creating that directory)

Hi PCNetSpec, so I just create the partion, format it to ext4 and apply changes, do I label it here? Then go to
CREATE THE MOUNT POINT of the tutorial and continue?
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on August 17, 2016, 05:18:23 pm
Egg Zactly  (and yes set the label in gparted whilst you're there (though the label is only for your info, it's not necessary) ;D
Title: Re: How To: Use symlinks to a DATA partition
Post by: alynur on August 17, 2016, 08:22:06 pm
Egg Zactly  (and yes set the label in gparted whilst you're there (though the label is only for your info, it's not necessary) ;D

Got it, thanks again.
Title: Re: How To: Use symlinks to a DATA partition
Post by: alynur on August 19, 2016, 12:35:36 pm
Hi Slim.Fatz, I don't know why, but for some reason this just didn't want to work. After following the tutorial step for step, when I openned DATA And tried to make a new folder, that option was shaded. I had to create another directory and finally I was able to make new documents. My link command looked like this ln -s /mnt/DATA/DATA/DATA/. I was finally able to make the links and it all works but what the heck? Basically that's what I had to do in my computer as well and hence I was asking about the mount point of the DATA partition. But it's working.  :-\
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on August 19, 2016, 01:25:50 pm
You must have forgot to do the
Code: [Select]
sudo chown -R aylnur:aylnur /mnt/DATA
(or similar)

with DATA already mounted, to recursively take ownership of the mountpoint
Title: Re: How To: Use symlinks to a DATA partition
Post by: alynur on August 19, 2016, 02:00:40 pm
You must have forgot to do the
Code: [Select]
sudo chown -R aylnur:aylnur /mnt/DATA
(or similar)

with DATA already mounted, to recursively take ownership of the mountpoint

Hi PCNetSpec, I did that a bunch of times, the only thing that finally worked was making more directories
Title: Re: How To: Use symlinks to a DATA partition
Post by: alynur on August 21, 2016, 05:28:09 pm
I need to give a SHOUT OUT and THANK YOU to AndyInMokum for helping me get all this straightened out. My hat is off to you sir!  :)
Title: Re: How To: Use symlinks to a DATA partition
Post by: madentaiwn on November 02, 2016, 09:46:57 pm
Hello,

Noon question. If I were to follow us instructors and setup a data partition, would windows be able to read it? I have my setup as windows 10 and PM dual boot

So I'm thinking about setting it up like this

Win10 40Gb
/boot 400mb
/ 40Gb
/mnt/DATA 390 GB
/swap 8Gb

Going to reinstall Windows clean first then work on the partitions for PM7. Is there anything else I should keep in mind?

Thanks
Title: Re: How To: Use symlinks to a DATA partition
Post by: Slim.Fatz on November 03, 2016, 02:59:12 am
Hi madentaiwn,

As given in the current instructions, Windoze cannot read the DATA partitition. I do not use Windoze and do not know the exact method to solve your problem. I am sure that someone else with knowledge of Windoze will give the correct method soon.

I do know that the problem is the filesystem used for the DATA partition: Windoze cannot read so many different types as Linux. I think that you need to use something like NTFS for Windoze, but I do not know the corrections you need to make in the Linux file fstab, etc.

Regards,

-- Slim
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on November 03, 2016, 08:23:54 am
As long as the DATA partition was on a partition with a file system Windows can read YES.

You just want to make sure the DATA partition was formatted say NTFS, and was mounted as accessible by everyone.
Title: Re: How To: Use symlinks to a DATA partition
Post by: madentaiwn on November 03, 2016, 04:43:28 pm
 :D :D Windoze, you crack me up dude.

Thanks for the info guys. I will try it out tonight.
Title: Re: How To: Use symlinks to a DATA partition
Post by: snide on May 01, 2017, 04:21:25 pm
What would I need to do to adapt this procedure to a multi user environment? Let's say I have 3 users (user1, user2, user3) for whom I would like to keep personal data on a single separate DATA partition?
Title: Re: How To: Use symlinks to a DATA partition
Post by: AndyInMokum on May 01, 2017, 05:31:01 pm
Hi madentaiwn,

As given in the current instructions, Windoze cannot read the DATA partitition. I do not use Windoze and do not know the exact method to solve your problem. I am sure that someone else with knowledge of Windoze will give the correct method soon.

I do know that the problem is the filesystem used for the DATA partition: Windoze cannot read so many different types as Linux. I think that you need to use something like NTFS for Windoze, but I do not know the corrections you need to make in the Linux file fstab, etc.

Regards,

-- Slim

If you want to share files with Windoze on dual boot system.  You'll need to format your shared /DATA partition to NTFS, not ext4.  The /etc/fstab entry is also slightly different.  The following link from the Linux Mint gang, provides the correct format for mounting an NTFS partition in /etc/fstab: HOWTO: Create & Use a Separate DATA Partition (https://community.linuxmint.com/tutorial/view/1609)  ;).
Title: Re: How To: Use symlinks to a DATA partition
Post by: AndyInMokum on June 06, 2017, 07:44:08 pm
Hi spence, I see you're having fun  ;D.  Have you any critical data in /mnt/DATA/DATA/DATA/DATA/video folder?  Do you have all your critical data either backed up, or still in your /home directory?  I'm simply making sure your critical data is in a safe place before you start deleting files and directories  ;).
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on July 11, 2018, 03:15:06 pm
In the tutorial it says:

Quote
In your file manager you should now see a folder icon with the name Documents and it should have a little "arrow" in one corner (indicating that this is a symlink).

After I was finished I never saw any of the folders with the little arrow. This is what my partitions look like:

(https://i.imgur.com/CArC766.png)

I had originally installed Peppermint 9 before following the symlink tutorial and had made a separate partition as a home folder with all my files so you can see the mount point for sda2 is for  both the DATA and home. Is this correct or do I need to somehow unassociate the home folder (sda2) from being a link to my files also?
Title: Re: How To: Use symlinks to a DATA partition
Post by: Slim.Fatz on July 11, 2018, 03:53:27 pm

Hi ogopogo,



The tutorial, as written, requires an EXTRA partition for your personal data files -- not a folder within the /home folder (or in your case /home partition). There is really no need to create an extra /home partition. It will normally be created within the / (root) partition. So you only need to create an extra DATA partition.



Regards,



 -- Slim

Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on July 11, 2018, 08:40:40 pm
Thank you Slim.Fatz  that makes perfect sense.

So this is what I see to do next:  I need to make a separate DATA partition, copy all my files over from the home partition to the DATA partition  then following the tutorial, symlink the root partition folders to the DATA partition then once satisfied that it works, delete the home partition (as it is no longer needed)... correct?  Sorry for being a pain in the NooB
Title: Re: How To: Use symlinks to a DATA partition
Post by: AndyInMokum on July 11, 2018, 08:47:44 pm
In the tutorial it says:

Quote
In your file manager you should now see a folder icon with the name Documents and it should have a little "arrow" in one corner (indicating that this is a symlink).

After I was finished I never saw any of the folders with the little arrow. This is what my partitions look like:

(https://i.imgur.com/CArC766.png)

I had originally installed Peppermint 9 before following the symlink tutorial and had made a separate partition as a home folder with all my files so you can see the mount point for sda2 is for  both the DATA and home. Is this correct or do I need to somehow unassociate the home folder (sda2) from being a link to my files also?

No this is not correct and not what the instructions are telling you to do.   The way you have it, defeats having a /DATA partition  :(.   

Before you install Peppermint 9, first manually make a partition table.  I use GParted to do this.  It's installed by default on the LiveMedia you made.  If you're going to use just /(root) mount point at installation. I'd give Peppermint 9 no more than 25GB.  You could get away with 20GB.  If you're like me and also use a /home partition.  I'd give the /(root) partition 10GB and the /home partition around 12GB.  If you make the /home partition too small, you end up having problems with the Trash/Rubbish bin contents filling up the whole partition.   I like to keep a /home partition.  It makes reinstalling quick and easy.  I do a lot of testing and I  break my system a lot.  Just doing a /(root) maintenance installation and not touching the /home partition saves time.  The /home partition is very much optional though.  Whatever is left over, I use for the /DATA partition.  You have this made and formatted to ext4 for, Linux only and to NTFS, if you're going to share it with Windows.  Adding the label, /DATA is useful as a reference  ;).

Note:  The /DATA partition plays no part in the installation process

When asked what type of installation you want to do, choose: Something Else.  From there you choose which partition(s) you're going to use and where to put the bootloader.  If you've only one distro, it's usually /dev/sda.  Remember do nothing with the /DATA partition.

After the installation has completed,  Open a terminal with the following key strokes:

Ctrl+Alt+t

Enter, (Copy & Paste)  the following commands into the terminal window, hit enter and post the outputs back to the forum:
Code: [Select]
sudo fdisk -l
followed by:
Code: [Select]
sudo blkid
Once we have this information , it's easy to walk you through the process.  In the meantime let's backup a file you're going to be editing a little later.  In the terminal window, enter, (Copy & Paste)  the following command:
Code: [Select]
sudo cp -v /etc/fstab /etc/fstab.bak
and hit enter.  Now we'll wait on the requested outputs  ;).
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on July 14, 2018, 12:06:59 am
AndyInMokum,   Sorry for the delay.... deadlines to be taken care of.....

So not wanting to have to start all over again with another fresh installation of Peppermint 9, I made another partiton named DATA, and then followed the tutorial on symlinks. This time it worked! However, one thing I'm not sure about is the Desktop folder. Obviously when all the files and links that were on my desktop were moved to the DATA partition, the only thing I was left with on the desktop was the symlink. See below:

(https://i.imgur.com/DfYMAXv.png)

 I guess I will either have to click on the link each time I want to go to my desktop folder (to keep the /home partition small) or remove the link and move all my desktop files back but having to increase the size of the /home folder to what ever size I think might be needed to handle the items I put there.
If I did it this second way, then when  it comes time to upgrade Peppermint, I just have to remember to move these files to the DATA partition to be able to keep them intact through the new installation/upgrade. Is there something I am missing or are these my options?
 
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on July 15, 2018, 08:59:13 am
Something is wrong here...

What's the output from:
Code: [Select]
ls -al ~/ | grep "->"
Title: Re: How To: Use symlinks to a DATA partition
Post by: AndyInMokum on July 15, 2018, 06:39:45 pm
Hi ogopogo, it's not a problem mate  ;).  Yeah, it's as PCNetSpec has said, something is wrong.  The folders in the Nemo file manager should show the sylinks.  These are the folders with the curled arrow in the bottom right corner.   See bellow:

Click on Image to Enlarge

(https://i.imgur.com/pYPksBu.png)

I have Nemo in dual pane mode and I've called my /DATA partition, /mnt/STORAGE.   I recommend you follow the instructions PCNetSpec gives you.  He'll get to the bottom of it  ;).
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on July 15, 2018, 08:53:02 pm
Here is the output:

Code: [Select]
gerry@gerry-X542BA ~ $ ls -al ~/ | grep "->"
grep: invalid option -- '>'
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
gerry@gerry-X542BA ~ $
Title: Re: How To: Use symlinks to a DATA partition
Post by: AndyInMokum on July 16, 2018, 01:10:56 am
Oops, that ain't right  :(.  Try this and post all the outputs back to the forum, (remember to, Copy & Paste commands into the terminal window  ;)):
Code: [Select]
ls -al ~/ | grep ^l
followed by this:
Code: [Select]
sudo fdisk -l
and
Code: [Select]
ls -a /mnt/DATA
followed by:
Code: [Select]
sudo blkid
and finally:
Code: [Select]
cat /etc/fstab
Whew  :)!

Note: When posting terminal outputs, could you please remember to encapsulate them with the Insert, Code # function.  For extra long outputs, please use the Spoiler, Sp function.  If you're using either the Chromium Browser or Google Chrome, don't combine these functions.  Only use one or the other per output  ;).  These functions preserve the original format of the output.  Doing this is a huge help  ;).  It makes it much easier for future visitors to relate terminal outputs to their own issues.  These functions are found in the forum editor, above the,  :-[ Embarrassed and  the :'( Cry emoticon respectively.  You can click on the Preview button to see how it'll look in the forum - many thanks  ;).
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on July 16, 2018, 08:08:15 am
Oops my mistake, try
Code: [Select]
ls -al / | grep "\->"
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on July 16, 2018, 11:35:21 am
AndyInMokum,     Not sure if some of these are considered "extra long outputs" but here they are:

...and thank you for the mini tutorial on their location and use.....

ls -al ~/ | grep ^l
Code: [Select]
lrwxrwxrwx  1 gerry gerry      17 Jun 14 08:37 .face.icon -> /home/gerry/.face

sudo fdisk -l
Code: [Select]
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 39F421BE-FBED-4843-AC07-3B85635E0910

Device        Start        End    Sectors  Size Type
/dev/sda1      2048    1050623    1048576  512M EFI System
/dev/sda2  32507904   70252543   37744640   18G Linux filesystem
/dev/sda3   1050624   32507903   31457280   15G Linux filesystem
/dev/sda4  70252544 1953523711 1883271168  898G Linux filesystem

Partition table entries are not in disk order.

ls -a /mnt/DATA
Code: [Select]
.  ..  Desktop  Documents  lost+found  Music  Pictures  .Trash-0  Videos

sudo blkid
Code: [Select]
/dev/sda1: LABEL="BOOT" UUID="84C4-377A" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="13658ccf-8e1a-4273-847a-0c296275e6a2"
/dev/sda2: LABEL="/home" UUID="2c6a20db-1cb8-4168-ae39-0d3e4b6e0270" TYPE="ext4" PARTLABEL="Home" PARTUUID="74f3bda8-e875-4fba-903c-b87538ec1ae2"
/dev/sda3: LABEL="/" UUID="d747ec97-d505-4a37-9211-f11d35851d5f" TYPE="ext4" PARTLABEL="Linux os" PARTUUID="ccaa11ac-1da3-4bbb-856d-a48f1a3743d1"
/dev/sda4: LABEL="/DATA" UUID="0bf84ff1-6444-4549-8d0c-8e23295d477b" TYPE="ext4" PARTLABEL="DATA" PARTUUID="a8bb30c5-cf60-4c76-8ffd-9334c09fafa9"

cat /etc/fstab
Code: [Select]
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdb3 during installation
UUID=d747ec97-d505-4a37-9211-f11d35851d5f /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sdb1 during installation
UUID=84C4-377A  /boot/efi       vfat    umask=0077      0       1
# /home was on /dev/sdb2 during installation
UUID=2c6a20db-1cb8-4168-ae39-0d3e4b6e0270 /home           ext4    defaults        0       2
/swapfile                                 none            swap    sw              0       0
/dev/disk/by-id/usb-WD_My_Passport_0820_575846314541343836504641-0:0-part1 /mnt/usb-WD_My_Passport_0820_575846314541343836504641-0:0-part1 auto nosuid,nodev,nofail,x-gvfs-show 0 0
# DATA partition /dev/sda4 is at /mnt/DATA ...
/dev/sda4   /mnt/DATA   ext4   noatime,defaults   0  0





Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on July 16, 2018, 11:38:39 am
PCNetSpec,   2nd attempt.....

ls -al / | grep "\->"

Code: [Select]
lrwxrwxrwx   1 root root        33 Jul  7 20:16 initrd.img -> boot/initrd.img-4.15.0-23-generic
lrwxrwxrwx   1 root root        33 Jul  7 20:11 initrd.img.old -> boot/initrd.img-4.15.0-23-generic
lrwxrwxrwx   1 root root        30 Jul  7 20:16 vmlinuz -> boot/vmlinuz-4.15.0-23-generic
Title: Re: How To: Use symlinks to a DATA partition
Post by: AndyInMokum on July 16, 2018, 12:17:51 pm
Are you using an SSD or an HDD?  I'm asking because the way you've setup your /DATA partition in /etc/fstab is not the recommended way.  If the partition designation changes, your /DATA partition won't mount.  You need to use the UUID of the partition.  I'm asking if you use an SSD because you're applying noatime to the /DATA partition.  I'm curious why it's not applied to your / and /home partitions  :-\?
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on July 16, 2018, 01:16:37 pm
Damnit .. I'll get this right eventually. :-[

Can you post the output from
Code: [Select]
ls -al ~/ | grep "\->"
and
Code: [Select]
ls -al ~/Desktop
and
Code: [Select]
ls -al /mnt/DATA
and
Code: [Select]
ls -al /mnt/DATA/Desktop
and
Code: [Select]
sudo blkid
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on July 16, 2018, 04:57:17 pm
AndyInMokum,     HDD  ...... The other stuff you mentioned, I don't think I had any other intention other than to follow the tutorial so if I did something that doesn't look right, it was probably  my error. 



PCNetSpec,   No problemo man.... I know what its like!!!  Good practice for me too.

ls -al ~/ | grep "\->"
Code: [Select]
lrwxrwxrwx  1 gerry gerry      17 Jun 14 08:37 .face.icon -> /home/gerry/.face

ls -al ~/Desktop  .... as you can see I like having a desktop to put stuff at least temporarily without having to click on a link to get to my 'real' desktop
Code: [Select]
total 9900
drwxr-xr-x  2 gerry gerry     4096 Jul 15 21:10  .
drwxr-xr-x 33 gerry gerry     4096 Jul 15 21:36  ..
lrwxrwxrwx  1 gerry gerry       17 Jul 13 20:24  Desktop -> /mnt/DATA/Desktop
-rw-rw-r--  1 gerry gerry      197 Jul 15 17:28 'Internet hacks'
-rw-rw-r--  1 gerry gerry     5897 Jul 15 12:37  shopping
-rw-rw-r--  1 gerry gerry      216 Jul 15 21:10 'Untitled Document'
-rw-rw-r--  1 gerry gerry 10111240 Jul 14 20:37  UV-R50_Quansheng_manual.pdf

ls -al /mnt/DATA
Code: [Select]
total 48
drwxr-xr-x  9 root root  4096 Jul 13 20:16 .
drwxr-xr-x  4 root root  4096 Jul 11 11:36 ..
drwxr-xr-x  7 root root  4096 Jul 13 20:20 Desktop
drwxr-xr-x 19 root root  4096 Jul 11 21:21 Documents
drwx------  2 root root 16384 Jul 11 19:54 lost+found
drwxr-xr-x 20 root root  4096 Jul 11 20:54 Music
drwxr-xr-x 32 root root  4096 Jul 11 20:55 Pictures
drwx------  4 root root  4096 Jul 11 21:18 .Trash-0
drwxr-xr-x 33 root root  4096 Jul 11 21:24 Videos

sudo blkid
Code: [Select]
/dev/sda1: LABEL="BOOT" UUID="84C4-377A" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="13658ccf-8e1a-4273-847a-0c296275e6a2"
/dev/sda2: LABEL="/home" UUID="2c6a20db-1cb8-4168-ae39-0d3e4b6e0270" TYPE="ext4" PARTLABEL="Home" PARTUUID="74f3bda8-e875-4fba-903c-b87538ec1ae2"
/dev/sda3: LABEL="/" UUID="d747ec97-d505-4a37-9211-f11d35851d5f" TYPE="ext4" PARTLABEL="Linux os" PARTUUID="ccaa11ac-1da3-4bbb-856d-a48f1a3743d1"
/dev/sda4: LABEL="/DATA" UUID="0bf84ff1-6444-4549-8d0c-8e23295d477b" TYPE="ext4" PARTLABEL="DATA" PARTUUID="a8bb30c5-cf60-4c76-8ffd-9334c09fafa9"








Title: Re: How To: Use symlinks to a DATA partition
Post by: AndyInMokum on July 16, 2018, 06:01:41 pm
That's great.  After PCNetSpec has sorted out the issue with your symlinks, you'll need to change the Block Device Method of mounting devices, to the far safer, UUID Method.  This done by making some small edits to the /etc/fstab file  ;).

Run, (Copy & Paste) the following command into a terminal window:
Code: [Select]
sudo xed /etc/fstab
At the bottom of file that opens, you'll find the lines:
Code: [Select]
# DATA partition /dev/sda4 is at /mnt/DATA ...
/dev/sda4   /mnt/DATA   ext4   noatime,defaults   0  0
replaced (Copy & Paste) them with:
Code: [Select]
# User defined DATA partition. Created by "ogopogo".  Mount point is at /mnt/DATA ...
UUID=0bf84ff1-6444-4549-8d0c-8e23295d477b /mnt/DATA ext4 defaults 0 2
To minimize any errors, please Copy & Paste the amendment to the file.  Save and exit the xed text editor.  That should set the content /etc/fstab to remain stable.

For extra credit, here are a couple of links that explain adding items to /etc/fstab.  It's a really handy thing to learn about: How To Add Items To The Fstab File In Linux (https://www.addictivetips.com/ubuntu-linux-tips/add-items-to-the-fstab-file-in-linux/) and Introduction to fstab (https://help.ubuntu.com/community/Fstab)  ;).
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on July 16, 2018, 09:32:22 pm
Thank you for the input AndyInMokum   ....as you mentioned I will wait till PCNetSpec gets back before making your suggested changes.
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on July 17, 2018, 12:13:20 pm
Okay, the first thing we need to do is make the /DATA partition read/write by gerry:
Code: [Select]
sudo chown -R gerry:gerry /mnt/DATA
now we need to copy some files from your current desktop to /mnt/DATA/Desktop/
Code: [Select]
cp -v "~/Desktop/Internet hacks" /mnt/DATA/Desktop/
then
Code: [Select]
cp -v "~/Desktop/shopping" /mnt/DATA/Desktop/
then
Code: [Select]
cp -v "~/Desktop/Untitled Document" /mnt/DATA/Desktop/
then
Code: [Select]
cp -v "~/Desktop/UV-R50_Quansheng_manual.pdf" /mnt/DATA/Desktop/
now we need to rename the old ~/Desktop folder and can create a symlink in its place .. this has to be done pretty quickly (in one command) so it happens before the desktop folder is automagically regenerated
Code: [Select]
mv -v ~/Desktop ~/Desktop-old && ln -s /mnt/DATA/Desktop ~/Desktop
Now what's the output from:
Code: [Select]
ls -al ~/ | grep "\->"
and
Code: [Select]
ls -al ~/Desktop
and can you confirm the desktop is working as expected, and that anything you put on the desktop appears in /mnt/DATA/Desktop ?

and can you also confirm that the:-
/mnt/DATA/Documents
/mnt/DATA/Music
/mnt/DATA/Pictures
/mnt/DATA/Videos

contain ALL your stuff .. before we do those symlinks too.
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on July 17, 2018, 10:26:23 pm
PCNetSpec

Quote
now we need to copy some files from your current desktop to /mnt/DATA/Desktop/
Code: [Select]

cp -v "~/Desktop/Internet hacks" /mnt/DATA/Desktop/

With this first copy it gave me the following output:

Code: [Select]
gerry@gerry-X542BA ~ $ cp -v "~/Desktop/Internet hacks" /mnt/DATA/Desktop/
cp: cannot stat '~/Desktop/Internet hacks': No such file or directory

The "internet hacks" file was still on the Desktop when I did this but when I opened a Nemo window and selected Desktop, the file was located at /home/gerry/Desktop/Internet hacks  not at: ~/Desktop/Internet hacks
Anyway, I manually copied all 4 of the files from the /home/gerry/Desktop and pasted them to the  /mnt/DATA/Desktop/


Quote
Now what's the output from:
Code: [Select]

ls -al ~/ | grep "\->"
Code: [Select]
lrwxrwxrwx  1 gerry gerry      17 Jul 17 17:38 Desktop -> /mnt/DATA/Desktop
lrwxrwxrwx  1 gerry gerry      17 Jun 14 08:37 .face.icon -> /home/gerry/.face
Quote
and
Code: [Select]

ls -al ~/Desktop
Code: [Select]
lrwxrwxrwx 1 gerry gerry 17 Jul 17 17:38 /home/gerry/Desktop -> /mnt/DATA/Desktop

Quote
and can you confirm the desktop is working as expected, and that anything you put on the desktop appears in /mnt/DATA/Desktop ?

My  /mnt/DATA/Desktop/ and /home/gerry/Desktop act the same. Whenever I add or subtract a file from one of these directories, the other one follows as well.
So I have 2 identical Desktops but are in different directories
Also, the Desktop icon in Nemo now has a little arrow in the bottom right hand corner

Quote
and can you also confirm that the:-
/mnt/DATA/Documents
/mnt/DATA/Music
/mnt/DATA/Pictures
/mnt/DATA/Videos
contain ALL your stuff .. before we do those symlinks too.

These other folders I think are working ok....meaning when I open Nemo and click on any one of them, the link goes to /mnt/DATA/Documents (or Music or PIctures or Videos). No double files in 2 directories like the Desktop.  However, there is no little arrows on the icons....maybe because I one at a time I deleted the Documents, Music, Pictures and Videos folder icons and manually from the /mnt/DATA folder dragged that folder over to create its link there. I couldn't do this to the Desktop or Home icon because it wouldn't give me the option to delete them. Totally not command line but its where my thinking was at the time. I'd be happy to do it all again if you think this is not correct.

Screenshots for clarity:

Videos folder in Nemo linking to /mnt/DATA/Videos but with no arrows

  (https://imgur.com/nAXSSxPl.png)

Desktop folder in Nemo NOT linking to /mnt/DATA/Desktop (or Home)

 (https://i.imgur.com/nAXSSxP.png)

  (https://imgur.com/ZxkhSv4l.png)
 (https://i.imgur.com/ZxkhSv4.png)
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on July 18, 2018, 03:53:32 am
Okay a symlink isn't a real directory/file, it's simply a shortcut to another location.

It now seems like
~/Desktop
is a proper symlink (shortcut in Windows parlance) to /mnt/DATA/Desktop

But

It looks like the:-
~/Documents
~/Music
~/Pictures
~/Videos
directories are NOT .. they're probably just copies of each other .. this is NOT what you want.
a) it's wasting space
and more importantly
b) it's not doing the intended job of making sure anything written to those directories is ACTUALLY being save in /mnt/DATA instead

To test this, please run these 4 commands
Code: [Select]
touch ~/Documents/pcnetspec-test.txt
touch ~/Music/pcnetspec-test.txt
touch ~/Pictures/pcnetspec-test.txt
touch ~/Videos/pcnetspec-test.txt
Now I'm assuming there is a copy of a file called "pcnetspec-test.txt" in the 4 folders in your home directory, but NOT in the same 4 directories in /mnt/DATA .. am I right ?

If you're not sure what I'm asking there, please post the output from these 8 commands
Code: [Select]
ls -l ~/Documents/pcnetspec-test.txt
ls -l ~/Music/pcnetspec-test.txt
ls -l ~/Pictures/pcnetspec-test.txt
ls -l ~/Videos/pcnetspec-test.txt
ls -l /mnt/DATA/Documents/pcnetspec-test.txt
ls -l /mnt/DATA/Music/pcnetspec-test.txt
ls -l /mnt/DATA/Pictures/pcnetspec-test.txt
ls -l /mnt/DATA/Videos/pcnetspec-test.txt
I'm betting the first 4 of those return something, but the last 4 throw a "doesn't exist" error .. am I right ?
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on July 18, 2018, 12:59:19 pm
Quote
To test this, please run these 4 commands
Code: [Select]

touch ~/Documents/pcnetspec-test.txt
touch ~/Music/pcnetspec-test.txt
touch ~/Pictures/pcnetspec-test.txt
touch ~/Videos/pcnetspec-test.txt

Now I'm assuming there is a copy of a file called "pcnetspec-test.txt" in the 4 folders in your home directory, but NOT in the same 4 directories in /mnt/DATA .. am I right ?

and.....
Quote
I'm betting the first 4 of those return something, but the last 4 throw a "doesn't exist" error .. am I right ?

Yes, you are correct to both
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on July 18, 2018, 01:50:48 pm
Okay run these 4 commands in sequence
Code: [Select]
mv -v ~/Documents ~/Documents-old && ln -s /mnt/DATA/Documents ~/Documents
then
Code: [Select]
mv -v ~/Music ~/Music-old && ln -s /mnt/DATA/Music ~/Music
then
Code: [Select]
mv -v ~/Pictures ~/Pictures-old && ln -s /mnt/DATA/Pictures ~/Pictures
then
Code: [Select]
mv -v ~/Videos ~/Videos-old && ln -s /mnt/DATA/Videos ~/Videos
if you get any errors, post them here

If you get no errors, post the output from:
Code: [Select]
ls -al ~/ | grep "\->"
and confirm those 4 folders in your home folder now have an arrow on them AND CONTAIN ALL YOUR STUFF .. be 100% positive of this because the next step is going to be to delete the folder copies that now end with "-old".
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on July 18, 2018, 02:23:44 pm
Quote
If you get no errors, post the output from:
Code: [Select]
ls -al ~/ | grep "\->"
lrwxrwxrwx  1 gerry gerry      17 Jul 17 18:23 Desktop -> /mnt/DATA/Desktop
lrwxrwxrwx  1 gerry gerry      19 Jul 18 11:13 Documents -> /mnt/DATA/Documents
lrwxrwxrwx  1 gerry gerry      17 Jun 14 08:37 .face.icon -> /home/gerry/.face
lrwxrwxrwx  1 gerry gerry      15 Jul 18 11:14 Music -> /mnt/DATA/Music
lrwxrwxrwx  1 gerry gerry      18 Jul 18 11:14 Pictures -> /mnt/DATA/Pictures
lrwxrwxrwx  1 gerry gerry      16 Jul 18 11:14 Videos -> /mnt/DATA/Videos

All folders (on right only) have little arrows and DO contain all my stuff.... I have made a backup on a separate drive just in case

  (https://imgur.com/AlUJ3G5l.png)
 (https://i.imgur.com/AlUJ3G5.png)
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on July 18, 2018, 04:29:39 pm
Okay feel free to delete the directories
~/Desktop-old
~/Documents-old
~/Music-old
~/Pictures-old
~/Videos-old




You appear to be missing one "Downloads"

If you want that one too...

a) Create a directory at:-
/mnt/DATA/Downloads

b) Copy anything in
~/Downloads
into it.

c) Run:
Code: [Select]
mv -v ~/Downloads ~/Downloads-old && ln -s /mnt/DATA/Downloads ~/Downloads
d) When you're sure the symlink is working, feel free to delete
~/Downloads-old
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on July 18, 2018, 08:44:56 pm
Old directories deleted.  I never use Downloads folder, I always have anything I download go to the desktop, but thanks for the catch.
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on July 19, 2018, 10:03:09 am
Okay, all done :)

Next time you reinstall, make sure you keep the DATA partition .. then it'll simply be a case of mounting it in your fresh install, then recreating the symlinks.



In fact it'd be possible to share the DATA partition and folders across more than one distro if you multi boot.
(though unless the UUID's are the same you may need to make it read/writeable by anyone)
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on July 20, 2018, 12:10:36 am
Thank you PCNetSpec for the baby steps tutorial.
Title: Re: How To: Use symlinks to a DATA partition
Post by: AndyInMokum on July 20, 2018, 01:41:20 am
That's great.  After PCNetSpec has sorted out the issue with your symlinks, you'll need to change the Block Device Method of mounting devices, to the far safer, UUID Method.  This done by making some small edits to the /etc/fstab file  ;).

Run, (Copy & Paste) the following command into a terminal window:
Code: [Select]
sudo xed /etc/fstab
At the bottom of file that opens, you'll find the lines:
Code: [Select]
# DATA partition /dev/sda4 is at /mnt/DATA ...
/dev/sda4   /mnt/DATA   ext4   noatime,defaults   0  0
replaced (Copy & Paste) them with:
Code: [Select]
# User defined DATA partition. Created by "ogopogo".  Mount point is at /mnt/DATA ...
UUID=0bf84ff1-6444-4549-8d0c-8e23295d477b /mnt/DATA ext4 defaults 0 2
To minimize any errors, please Copy & Paste the amendment to the file.  Save and exit the xed text editor.  That should set the content /etc/fstab to remain stable.

For extra credit, here are a couple of links that explain adding items to /etc/fstab.  It's a really handy thing to learn about: How To Add Items To The Fstab File In Linux (https://www.addictivetips.com/ubuntu-linux-tips/add-items-to-the-fstab-file-in-linux/) and Introduction to fstab (https://help.ubuntu.com/community/Fstab)  ;).

Now PCNetSpec has sorted your symlink tangle out  :).  Remember to make the above edit to your /etc/fstab file.  It'll ensure your /DATA partition mounts smoothly every time you boot up ;). 

What you've done to your system, is a very simple, very sensible and very slick modification - congratulations  ;).  It'll save you so much time when it comes to installing the next version of Peppermint.  Plus you could do some distro hopping, (if you can tear yourself away from Peppermint :)) ) with the confidence you're not going to run into conflicts, or more importantly, loss of data.   If you need any further help, or simply some advice, don't hesitate in letting us know  ;).

If you're happy with the solution.  Could you please remember to mark the topic as [SOLVED] in the subject line of the original post?   Many thanks  ;).
Title: Re: How To: Use symlinks to a DATA partition
Post by: murraymint on July 20, 2018, 08:34:16 am
I'm asking if you use an SSD because you're applying noatime to the /DATA partition.

That's because he followed Slim's tutorial to the letter.
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on July 20, 2018, 12:07:29 pm
Thank you PCNetSpec

You're most welcome ogopogo :)
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on July 20, 2018, 08:44:01 pm
AndyInMokum      Thank you for the reminder.... all done.

Quote
If you're happy with the solution.  Could you please remember to mark the topic as [SOLVED] in the subject line of the original post?   Many thanks  ;).

Being that I didn't start the post and just adding to SlimFat's post, do I mark my first  post or his at  the beginning of the tutorial?
Title: Re: How To: Use symlinks to a DATA partition
Post by: murraymint on July 20, 2018, 09:03:48 pm
No, don't worry about it for a tutorial.
Title: Re: How To: Use symlinks to a DATA partition
Post by: AndyInMokum on July 20, 2018, 09:10:29 pm
AndyInMokum      Thank you for the reminder.... all done.

Quote
If you're happy with the solution.  Could you please remember to mark the topic as [SOLVED] in the subject line of the original post?   Many thanks  ;).

Being that I didn't start the post and just adding to SlimFat's post, do I mark my first  post or his at  the beginning of the tutorial?

My bad, it's as murraymint says.  Doh  :-X!
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on September 20, 2018, 09:10:35 pm
Not sure if I should start another thread but it has to do with symlinks.

I just installed Oracle VM Virtualbox and created a Windows 7 VM with the help of PCNetSpec.

What I didn't realize at the time was that it was installed to my Home partition which is only 18 GB and as I copied some large files to the desktop it gave me an error saying that it was full.

Seeing as how I have my files all saved in a separate DATA partition (776 GB remaining) , can I also do this  (symlink) the Virtualbox VMs folder that contains the Windows 7 OS  .vbox and .vmdk files to the DATA partition as well?   
Title: Re: How To: Use symlinks to a DATA partition
Post by: Brotherred on September 20, 2018, 09:15:27 pm
It just me perhaps. But I would tell VirtualBox to store the VM folder/ image  in your data partition, if /home  storage is that limited.

Sent from my SM-N920V using Tapatalk
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on September 20, 2018, 10:19:10 pm
Not sure if I should start another thread but it has to do with symlinks.

I just installed Oracle VM Virtualbox and created a Windows 7 VM with the help of PCNetSpec.

What I didn't realize at the time was that it was installed to my Home partition which is only 18 GB and as I copied some large files to the desktop it gave me an error saying that it was full.

Seeing as how I have my files all saved in a separate DATA partition (776 GB remaining) , can I also do this  (symlink) the Virtualbox VMs folder that contains the Windows 7 OS  .vbox and .vmdk files to the DATA partition as well?

You certainly can :)

Move the Virtualbox VMs folder to your DATA partition .. then create a symlink to it in your home folder

Be sure to do this with Virtualbox NOT RUNNING



If you have any problems creating the symlink, let us know the full path to the Virtualbox VMs folder that's now on your DATA partition (this will depend on where you mounted the DATA partition).

If you're unsure, post the output from
Code: [Select]
mount
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on September 20, 2018, 11:49:43 pm
Quote
You certainly can :)

Move the Virtualbox VMs folder to your DATA partition .. then create a symlink to it in your home folder

Be sure to do this with Virtualbox NOT RUNNING

No problem moving the folder but having trouble with the symlink.

When I go to step #4 of this tutorial  (page #1) under the heading "CREATE SYMLINKS TO YOUR DATA PARTITION" it says:

Code: [Select]
ln -s /mnt/DATA/Documents Documents

Now my folder is called "VirtualBox VMs" so I substituted "Documents" as follows:

Code: [Select]
ln -s /mnt/DATA/VirtualBox VMs VirtualBox VMs

But what I got was:
Code: [Select]
ln: target 'VMs' is not a directory

If I leave out the space and call it:

Code: [Select]
ln -s /mnt/DATA/VirtualBoxVMs VirtualBoxVMs

The symlink file made in my home folder is "broken" as it doesn't exist.

So, seems like I need for you to spell it out for me....the output of mount is:

Code: [Select]
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=3768108k,nr_inodes=942027,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=766572k,mode=755)
/dev/sda3 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=24,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=14262)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/sda4 on /mnt/DATA type ext4 (rw,relatime,data=ordered)
/dev/sda2 on /home type ext4 (rw,relatime,stripe=32750,data=ordered)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=766568k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/fuse on /run/user/1000/doc type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

Title: Re: How To: Use symlinks to a DATA partition
Post by: murraymint on September 21, 2018, 04:22:02 am
Precede spaces in a path with a backslash

Code: [Select]
ln -s /mnt/DATA/VirtualBox\ VMs VirtualBox\ VMs
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on September 21, 2018, 10:00:12 am
it's the whitespace in the filename that's giving you problems .. you can escape the whitespace as in murraymints command above.

or

just make sure the paths are surrounded by quotation marks .. as in:
Code: [Select]
ln -s "/mnt/DATA/VirtualBox VMs" "VirtualBox VMs"
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on September 21, 2018, 12:01:15 pm
Thanks guys, it worked!
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on January 02, 2019, 12:59:00 pm
Hello!    I've just downloaded the latest version of "Peppermint-9-20181222-amd64" and am ready to do a fresh install. I've been running the previous version of Peppermint 9 now with no problems and have all my files in a DATA partition..... thanks to the wonderful help I received from here.   :)

Before I continue with following the symlinks tutorial, I was just wondering if there is anything updated or special I might need to do before I continue?
Thank you in advance.
Title: Re: How To: Use symlinks to a DATA partition
Post by: PCNetSpec on January 03, 2019, 12:19:07 pm
Nope, the instructions should still remain the same .. in fact they should always remain the same and are not specific to Peppermint, they should be applicable to all Linux distros :)

Although, there's a new "Respin-2" of Peppermint 9 out dated (20190102), you can read about why here:
https://peppermintos.com/2019/01/peppermint-9-respin-2-released/
If you've already installed (20181222) there is absolutely no need to reinstall .. there are no changes other than some fixes for the installation routine
Title: Re: How To: Use symlinks to a DATA partition
Post by: ogopogo on January 03, 2019, 02:12:10 pm
Thank you for your reply PCNetSpec.
None of the fixes apply to me and I'm limited with my bandwidth so I'll go ahead with the .iso I already have.  8)
Title: Re: How To: Use symlinks to a DATA partition
Post by: Slim.Fatz on November 19, 2019, 10:51:46 am
BUMP -- to get this important tutorial back onto the first page of the User Submitted Tutorials. Unfortunately, too many new users are too impatient to take the time necessary to look much beyond the first page of the tutorials ...  :(

Regards,

-- Slim