Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

how to create permanent access to folders on other disk?

Linux Kernel, Network, and Services configuration.
Message
Author
User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: how to create permanent access to folders on other disk?

#16 Post by debiman »

canti wrote: Trying the reverse, i.e.

Code: Select all

ln -s /media/familie/testmedia /home/testhome
leads to the error that no symbolic link "/home/testhome" can be created: the access is denied.
this is the correct way, and the error is also correct.
try the same with sudo or su, then, before you mount anything:

Code: Select all

chown canti:canti /home/testhome

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: how to create permanent access to folders on other disk?

#17 Post by p.H »

canti wrote:/home -> should be /home/<my username>?
You mount a partition on /home if you want ALL normal user home directories to be stored in that partition.
You mount a partition on /home/<username> if you want <username> home directory contents to be stored in that partition.
You mount a partition on /home/<username>/<somedirectory> if you want <somedirectory> contents in <username> home directory to be stored in that partition.
Alternatively, you can mount a partition on any suitable empty directory (not /media, /mnt or their subdirectories) and create a symlink /home/<username>/<somelink> pointing to the mount point or any of its subdirectories.
canti wrote:noauto -> I took that from https://wiki.archlinux.org/index.php/fs ... _partition. I thought this fits my situation because my sdb is large (1 TB). But I can have understand it wrongly.
"noauto" has nothing to do with the filesystem size. It means "do no try to automatically mount the filesystem at boot or when running mount -a". You can use it when the filesystem is not always present at boot, or when you want to mount it manually.

canti
Posts: 74
Joined: 2011-01-31 12:57
Location: The Netherlands

Re: how to create permanent access to folders on other disk?

#18 Post by canti »

On sdb I have the following path /media/familie/data (when mounted manually to sdb without fstab, I did not choose the name "media", by the way; "familie" is my username). The directories containing data are in the directory "data" .
On sda the corresponding directories are in path /home/familie.

On advise of NFT5 and p.H. I have to create the /home directory on sdb. Probably the best way to do this is to rename "media/familie/data" into "/home/familie/data". But I'm afraid the command

Code: Select all

mv /media /home
will arise conflict with the existing /home/familie (on sda2 where pwd = /home/familie). Or should I use an other, better, way to execute that advise?
HP Envy 17 n120nd containing Debian Bullseye (Gnome 3)

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: how to create permanent access to folders on other disk?

#19 Post by GarryRicketson »

When I have that kind of concern,

Code: Select all

will arise conflict with the existing /home/familie 
I use a different name
IE: /home/familie/familie-1/
If a sub directory is ok, or create another user and have it's own directory :
IE: /home/familie-1
Maybe familie-data ? to be more descriptive.
I do not know if what you are doing would cause a conflict or not, but adding a number or letter would insure there is none. ( I think)

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: how to create permanent access to folders on other disk?

#20 Post by p.H »

canti wrote:

Code: Select all

mv /media /home
You don't want to do that. Really. You want to :
- unmount the filesystem from /media/familie/data
- create a directory /home/familie/data (if you want to access the contents of the filesystem under this path)
- add a line in /etc/fstab to mount the filesystem on /home/familie/data
- mount the filesystem

Note : the filesystem being mounted on /media/familie/data normally means its label is "data" and it was mounted in the GUI session opened by user "familie".

canti
Posts: 74
Joined: 2011-01-31 12:57
Location: The Netherlands

Re: how to create permanent access to folders on other disk?

#21 Post by canti »

p.H wrote: You don't want to do that.
Here I had my strong suspicion...
p.H wrote: - create a directory /home/familie/data (if you want to access the contents of the filesystem under this path)
I'm struggling to create the directory /home/familie/data on the filesystem sdb1 using the mkdir command, this seems not possible when this filesystem is unmounted
p.H wrote: Note : the filesystem being mounted on /media/familie/data normally means its label is "data" and it was mounted in the GUI session opened by user "familie".
Ah, interesting. So this probably means I only have to create /home/familie on sdb1 as this is already labeled as "data"?

Yes, I know I'm a long time Linux user, but still with limited knowledge of commands and basic principles of files structure. I'm a bit lazy thanks to the beautiful GUI Gnome and the good Debian installer. But I'm absolutely not averse to use Linux commands and like to learn them!
HP Envy 17 n120nd containing Debian Bullseye (Gnome 3)

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: how to create permanent access to folders on other disk?

#22 Post by Dai_trying »

I thought I would just put down here what I do to achieve this in case it might be useful to OP.

First I create an fstab entry to mount my "DATA" partition to /media/<username>/DATA/

Next (on a fresh installation) I remove (delete) any Documents/Downloads/Pictures/Videos folders from my $HOME.

After this I simply create a symlink to the relevant directories of my DATA partition. For simplicity I have them named Documents, Downloads, Pictures etc etc...

If you are in the "target" directory (where you want the symlink placed) and the folder name is the same in your DATA partition as you want to use in the filesystem you can use this simple command (replace "dai" with your own username)
sudo ln -s /media/dai/DATA/Documents

If your DATA folder names are different to what you want in your filesystem you can use this command to give your custom folder (sym-link) name.
sudo ln -s /media/dai/DATA/random_folder_name My_custom_folder

The reason I do this is to make easy use of all my data from different OS's (I usually have a multi-boot system with between 4 and 6 different OS's).

Note 1 I use the /media/<user>/ folder to place my mount which I have read on this forum is not good practice but I had been doing it this way for years without issue before reading that and so keep it this way, you may prefer to use a more "recommended" location for your mount point.

Note 2 I use sudo here but the same results can be achieved if you run the command as root another way.

Post Reply