LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-29-2018, 03:16 PM   #1
beefman
Member
 
Registered: Mar 2018
Posts: 34

Rep: Reputation: Disabled
Hard Link a desktop directory to another Drive's directory


Can I hard link a Desktop directory to another drive's directory.
I am trying to link Dropbox to my Linux Mint so I can modify files and the files on the second drive with both OS systems.

Thanks
 
Old 03-29-2018, 03:54 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Hard links are possible only within a single filesystem, and arbitrary** hard links to a directory are never possible. You'll have to use a symbolic link.

**The only hard links allowed for a directory are (a) from the directory's name in its parent directory, (b) the "." link in itself, and (c) the ".." links from each subdirectory (if any). Allowing other hard links to a directory would violate the tacit assumption that the directory structure is a tree. Various things start to break (sometimes badly) if that is not true.
 
Old 03-29-2018, 04:01 PM   #3
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 21 MATE, EndeavourOS, antiX, MX Linux
Posts: 3,972
Blog Entries: 32

Rep: Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465
beefman,

In Terminal:

Code:
ln -s /home/beefman/mynewdirectory /media/drive2/mynewdirectory

Last edited by beachboy2; 03-29-2018 at 04:11 PM.
 
1 members found this post helpful.
Old 03-29-2018, 04:09 PM   #4
beefman
Member
 
Registered: Mar 2018
Posts: 34

Original Poster
Rep: Reputation: Disabled
Thanks Beachboy, I was wondering if I could do that. I am just learning command line basic.
 
Old 03-29-2018, 04:52 PM   #5
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 21 MATE, EndeavourOS, antiX, MX Linux
Posts: 3,972
Blog Entries: 32

Rep: Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465
beefman,

In addition:

1. You also need to find out the unique universal identifier (UUID) for your drive2 using:

Code:
sudo blkid
Example output:

Code:
/dev/sda1: UUID="3c2d663a-19bc-432e-b910-9bbcee627a22" TYPE="ext4" PARTUUID="000bffa1-01"
/dev/sda2: UUID="cf7aeaf0-5262-42a2-bb8a-3bdfaf16a440" TYPE="swap" PARTUUID="000bffa1-02"
/dev/sda3: UUID="675b4170-fb8a-49df-a287-b3967775b23b" TYPE="ext4" PARTUUID="000bffa1-03"
/dev/sdb1: UUID="db442741-8805-4829-8d2b-292c4abb25ec" TYPE="ext4" PARTUUID="0007ccfb-01"
Copy the UUID for HDD drive2 (without the quotes):

db442741-8805-4829-8d2b-292c4abb25ec

2. Create new directory (drive2), followed by modifications to /etc/fstab file.

Code:
sudo mkdir /media/drive2
3. Modify the /etc/fstab file using:

Code:
 gksudo gedit /etc/fstab
OR

Code:
 sudo nano /etc/fstab

Example:

Code:
# /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/sda1 during installation
UUID=3c2d663a-19bc-432e-b910-9bbcee627a22 /   ext4    errors=remount-ro   0       1

# swap was on /dev/sda2 during installation
UUID=cf7aeaf0-5262-42a2-bb8a-3bdfaf16a440  none     swap    sw            0       0

# /home was on /dev/sda3 during installation
UUID=675b4170-fb8a-49df-a287-b3967775b23b /home  ext4    defaults         0       2

# /media/drive2 was on /dev/sdb1 after installation
UUID=db442741-8805-4829-8d2b-292c4abb25ec  /media/drive2  ext4  defaults  0       0
7. File > Save and Close.

8. Next, mount drive2:

Code:
sudo mount /dev/sdb1 /media/drive2
9. Reboot:
Code:
 sudo reboot
10. Then:
Code:
sudo chown -R beefman:beefman /media/drive2

Last edited by beachboy2; 03-29-2018 at 04:56 PM.
 
1 members found this post helpful.
Old 03-30-2018, 07:35 AM   #6
beefman
Member
 
Registered: Mar 2018
Posts: 34

Original Poster
Rep: Reputation: Disabled
I will work on that today. Thanks for the help.

By the way. The Ethernet problem is still there. The first time I changed the bios to enable onboard LAN and I booted into Linux- BANG!- she hooked up. When I left Linux, went back into Windows to get some password and re-entered Linux I had, and still have the same old problem. The Ethernet card address is seen, but it will not hook up.
Any ideas?

that post is at: https://www.linuxquestions.org/quest...73#post5836973


Thanks very much
Beefman

Last edited by beefman; 03-30-2018 at 07:48 AM.
 
Old 03-30-2018, 04:41 PM   #7
beefman
Member
 
Registered: Mar 2018
Posts: 34

Original Poster
Rep: Reputation: Disabled
beachboy2;

Here is what I have tentatively set up to modify a driv2 directory in media/drive2 by editing fstab.

# /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/sdb2 during installation
UUID=76399c09-3d81-4a2b-867d-05cbe1b8a63d / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sdb1 during installation
UUID=1A93-5BB6 /boot/efi vfat umask=0077 0 1
# /home was on /dev/sdb4 during installation
UUID=cf6ac260-df97-4c62-96f3-fabc7a2262c8 /home ext4 defaults 0 2
# swap was on /dev/sdb3 during installation
UUID=05b9f841-e531-4503-a84c-251543603095 none swap sw 0 0

#/media/drive2 was on /home after installation
UUID=cf6ac260-df97-4c62-96f3-fabc7a2262c8 /media/drive2 ext4 defaults 0 0


I am not sure where to place the two end zeros. The drive I am using is the /home partition, with about 180 GB.

I put the drive2 directory in /media, as you suggested.

I also don't understand "mount", and I need to know why you are having me do this. Will I be able to edit files on my Drive 1 (Windows 10), and Drive 2 (Linux) so that they will be edited and changes seen when opening from either OS.

Thanks, I hope I did this right.
CH
 
Old 03-30-2018, 04:45 PM   #8
beefman
Member
 
Registered: Mar 2018
Posts: 34

Original Poster
Rep: Reputation: Disabled
Bye the way - sda is windows drive 1, sdb is Linux drive 2 and all the partitions.

CH
 
Old 03-31-2018, 08:48 PM   #9
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 21 MATE, EndeavourOS, antiX, MX Linux
Posts: 3,972
Blog Entries: 32

Rep: Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465
beefman,

My apologies for totally misreading your request and giving the reply to a single Linux system on drive 1, with a permanently connected separate backup drive (drive 2).

Your question, as clearly stated in your original post was:

Quote:
Can I hard link a Desktop directory to another drive's directory.
I am trying to link Dropbox to my Linux Mint so I can modify files and the files on the second drive with both OS systems.
You later added:

Quote:
sda is windows drive 1, sdb is Linux drive 2 and all the partitions.
I am sure that other members can supply you with the correct procedure.
 
Old 04-01-2018, 06:25 AM   #10
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Hi beefman,

I'm slightly confused by your opening post. Could you please describe your system setup, and also explain what it is you're trying to do (without talking about hard links).
 
Old 04-01-2018, 07:30 AM   #11
beefman
Member
 
Registered: Mar 2018
Posts: 34

Original Poster
Rep: Reputation: Disabled
Thanks for the input!

I figured out an easy way - bookmarking the files I want to edit.

Thanks.

CH
 
Old 04-01-2018, 07:45 AM   #12
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
bind mounts

As others have mentioned and explained symbolic links, and pointed out that hard links cannot be used for diretories, I'll add that bind mounts are another way of remounting a hierarchy at more than one location. A bind mount would eventually go in /etc/fstab to make it permanent.

See the manual page for mount and scroll down to "Bind mounts" for the details.

Code:
man mount
So you would use it something like this to test it:

Code:
sudo mount --bind /home/beefman/myoriginaldirectory /media/drive2/mysecondlocation
Then you'd add it to /etc/fstab to make it persistent across reboots:

Code:
/home/beefman/myoriginaldirectory /media/drive2/mysecondlocation none bind 0 0
See the manual page for more

Code:
man fstab
 
Old 04-01-2018, 09:06 AM   #13
beefman
Member
 
Registered: Mar 2018
Posts: 34

Original Poster
Rep: Reputation: Disabled
That is great information, and I think the direction beachboy2 was leading me.
I will certainly read the manual and try the mount and fstab approach.

Thank you!
 
Old 04-01-2018, 09:27 AM   #14
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Quote:
Originally Posted by beefman View Post
I will certainly read the manual and try the mount and fstab approach.
Excellent. Being able to navigate the manuals is rather an essential skill to acquire. Keep in mind that they are reference documents and not intended (or appropriate) to be tutorials. For tutorials, you have the web or here. Also they do vary in quality, some are quite good, others not so good but always worth checking as a first step.
 
Old 04-01-2018, 09:31 AM   #15
beefman
Member
 
Registered: Mar 2018
Posts: 34

Original Poster
Rep: Reputation: Disabled
Thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Program to scan a directory and hard link common files? MikeyCarter Linux - Software 1 10-27-2015 09:34 AM
Embedded Linux Hard Link Suddenly Created on a Root Directory? sarmads1 Linux - Security 5 07-19-2012 06:21 PM
[SOLVED] Hard Link Directory podollb Linux - Server 5 01-30-2012 08:29 AM
Lubuntu 10.10 Symbolic Link to Desktop from Directory metallica1973 Linux - General 7 10-25-2010 08:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration