LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   A few Questions about Data Partitions (https://www.linuxquestions.org/questions/linux-newbie-8/a-few-questions-about-data-partitions-749861/)

Jeff91 08-24-2009 08:53 AM

A few Questions about Data Partitions
 
I have a 190gig data partition on my hard drive and I was wondering a few things.

First off when it mounted it auto mounted to the point /media/disk - from this point forward will it continue to mount to that same point or do I have to do something special for it to do this?

Second, can I install applications to a data partition instead of /home? My Cedega folder gets rather large when I have all my games in it and I would much prefer them to reside on the larger partition.

Lastly, I have a Desktop, Documents, Videos, Pictures, ect folders on my data partition. How would I go about creating a 'symlink' between these folders and the corresponding folder in my /home directory?

Thanks for taking the time to read this, any help/pointers would be great :)

~Jeff

firewiz87 08-24-2009 09:31 AM

Quote:

Originally Posted by Jeff91 (Post 3655462)
First off when it mounted it auto mounted to the point /media/disk - from this point forward will it continue to mount to that same point or do I have to do something special for it to do this?

Mounting using the mount command is temporary.... to make it automount on boot make an entry in /etc/fstab

Quote:

Originally Posted by Jeff91 (Post 3655462)
Second, can I install applications to a data partition instead of /home? My Cedega folder gets rather large when I have all my games in it and I would much prefer them to reside on the larger partition.

Yes you can.... just mount the data partition somewhere n then change the settings during install to point there.... instruction to change the installation path can be found in the application's readme (usually)

Quote:

Originally Posted by Jeff91 (Post 3655462)
Lastly, I have a Desktop, Documents, Videos, Pictures, ect folders on my data partition. How would I go about creating a 'symlink' between these folders and the corresponding folder in my /home directory?

Code:

ln -s /path/to/docs /home/jeff/link

kbp 08-24-2009 09:32 AM

Hi Jeff,

Firstly, I'm guessing the data drive is portable due to the fact that it mounted under /media. I think the name 'disk' is given to unlabelled media so it could possibly be mounted under a different mount point if you had something else plugged in first. To avoid this possibility you could label it and it would then get mounted under /media/'label'. (man e2label)

As far as installing applications goes, it depends on how they're packaged, eg. an rpm will have its install paths already defined
If it comes as a tarball (tar.gz, .tgz) and has a make file it may support the '--prefix' option which will allow you to install it wherever you like.


Replacing dirs with symlinks
*Please note that you may get some 'unexpected' results if the drive is not available at login, going the symlink route is possible but personally I wouldn't do it

Copy existing data in the Desktop, Documents, Videos, Pictures directories under your /home... directory, ensure the permissions match then delete the ones under /home... and replace with symlinks to /media/'label'/Desktop etc.

This is not tested but should give you an idea of the process:
Code:

#!/bin/bash

NAME=$(id -un)

if [ -z $NAME ]
then
  echo "Could not obtain user name, exiting"
  exit
fi

for dir in Desktop, Documents, Videos, Pictures
do
  echo "Moving $dir"
  # Copy existing data
  rsync -avz /home/${NAME}/$dir /media/disk/$dir
  if [ $? -eq 0 ]
  then
    # Remove directory
    rm -rf /home/${NAME}/$dir
    # Replace with symlink
    ln -s /media/disk/$dir /home/${NAME}/$dir
  else
    echo "Move of $dir failed"
  fi
done

cheers,

kbp

Jeff91 08-24-2009 09:47 AM

Actually the 190gig drive is an internal drive - I am multi booting my laptop so I want to share it between the different distros (Same docs and files ect) So it will always be "attached"

I'll give setting up fstab a go and will post back if I have any issues with it.

~Jeff


All times are GMT -5. The time now is 10:57 PM.