[SOLVED] Hard Link a desktop directory to another Drive's directory
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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
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?
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.
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.
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).
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:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.