Author Topic: How To: Use symlinks to a DATA partition  (Read 20584 times)

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: How To: Use symlinks to a DATA partition
« Reply #45 on: July 15, 2018, 05:59:13 am »
Something is wrong here...

What's the output from:
Code: [Select]
ls -al ~/ | grep "->"
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4889
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
Re: How To: Use symlinks to a DATA partition
« Reply #46 on: July 15, 2018, 03: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


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  ;).
« Last Edit: July 15, 2018, 04:14:50 pm by AndyInMokum »
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline ogopogo

  • Member
  • ***
  • Posts: 54
  • Karma: 0
  • New Forum User
    • View Profile
  • Peppermint version(s): Peppermint 9
Re: How To: Use symlinks to a DATA partition
« Reply #47 on: July 15, 2018, 05: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 ~ $
« Last Edit: July 15, 2018, 09:17:37 pm by AndyInMokum »

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4889
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
Re: How To: Use symlinks to a DATA partition
« Reply #48 on: July 15, 2018, 10:10:56 pm »
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 ^lfollowed by this:
Code: [Select]
sudo fdisk -land
Code: [Select]
ls -a /mnt/DATAfollowed by:
Code: [Select]
sudo blkidand finally:
Code: [Select]
cat /etc/fstabWhew  :)!

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  ;).
« Last Edit: July 16, 2018, 01:46:40 am by AndyInMokum »
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: How To: Use symlinks to a DATA partition
« Reply #49 on: July 16, 2018, 05:08:15 am »
Oops my mistake, try
Code: [Select]
ls -al / | grep "\->"
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline ogopogo

  • Member
  • ***
  • Posts: 54
  • Karma: 0
  • New Forum User
    • View Profile
  • Peppermint version(s): Peppermint 9
Re: How To: Use symlinks to a DATA partition
« Reply #50 on: July 16, 2018, 08: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






Offline ogopogo

  • Member
  • ***
  • Posts: 54
  • Karma: 0
  • New Forum User
    • View Profile
  • Peppermint version(s): Peppermint 9
Re: How To: Use symlinks to a DATA partition
« Reply #51 on: July 16, 2018, 08: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

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4889
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
Re: How To: Use symlinks to a DATA partition
« Reply #52 on: July 16, 2018, 09:17:51 am »
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  :-\?
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: How To: Use symlinks to a DATA partition
« Reply #53 on: July 16, 2018, 10:16:37 am »
Damnit .. I'll get this right eventually. :-[

Can you post the output from
Code: [Select]
ls -al ~/ | grep "\->"and
Code: [Select]
ls -al ~/Desktopand
Code: [Select]
ls -al /mnt/DATAand
Code: [Select]
ls -al /mnt/DATA/Desktopand
Code: [Select]
sudo blkid
« Last Edit: July 16, 2018, 10:22:16 am by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline ogopogo

  • Member
  • ***
  • Posts: 54
  • Karma: 0
  • New Forum User
    • View Profile
  • Peppermint version(s): Peppermint 9
Re: How To: Use symlinks to a DATA partition
« Reply #54 on: July 16, 2018, 01: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"









Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4889
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
Re: How To: Use symlinks to a DATA partition
« Reply #55 on: July 16, 2018, 03: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/fstabAt 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 and Introduction to fstab  ;).
« Last Edit: July 19, 2018, 10:46:25 pm by AndyInMokum »
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline ogopogo

  • Member
  • ***
  • Posts: 54
  • Karma: 0
  • New Forum User
    • View Profile
  • Peppermint version(s): Peppermint 9
Re: How To: Use symlinks to a DATA partition
« Reply #56 on: July 16, 2018, 06:32:22 pm »
Thank you for the input AndyInMokum   ....as you mentioned I will wait till PCNetSpec gets back before making your suggested changes.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: How To: Use symlinks to a DATA partition
« Reply #57 on: July 17, 2018, 09:13:20 am »
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/DATAnow 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 ~/DesktopNow what's the output from:
Code: [Select]
ls -al ~/ | grep "\->"and
Code: [Select]
ls -al ~/Desktopand 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.
« Last Edit: July 17, 2018, 09:21:41 am by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline ogopogo

  • Member
  • ***
  • Posts: 54
  • Karma: 0
  • New Forum User
    • View Profile
  • Peppermint version(s): Peppermint 9
Re: How To: Use symlinks to a DATA partition
« Reply #58 on: July 17, 2018, 07: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

 

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



 

« Last Edit: July 18, 2018, 01:34:15 am by AndyInMokum »

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: How To: Use symlinks to a DATA partition
« Reply #59 on: July 18, 2018, 12: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 ?
« Last Edit: July 18, 2018, 12:56:06 am by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec