LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 04-17-2009, 03:22 PM   #1
spydyee
LQ Newbie
 
Registered: Apr 2009
Posts: 1

Rep: Reputation: 0
Unhappy Help me use a external USB drive for my /home directory


Ok be patient here. I am really new to Linux and my husband who is much better than me is really too busy to help me. I have avoided these forums for a while because he has been able to help me in the past. I am a homeschooling mom who is using moodle on a Red Hat Fedora Core 10 Linux server for my kids to access their school work from. It is on a really old hardware system that cannot boot from USB so we cannot put the operating system on the terabyte usb drive we have. I need to move the /home directory (because moodle is located in the /home directory and has to be according to my husband I don't understand this because he set it up) to the USB drive. However, it seems from what assistance my husband was able to e-mail to me that fedora is not recognizing the USB drive before it runs fstab and that is causing the hiccup it is having. How can I get Linux to recognize the USB drive before it loads fstab or whatever I have to do to be able to migrate my /home directory to the terabyte drive in order to make moodle work from there. I really need the storage space in order to put up the work for the kids. I have three kids, all in different grades so I have a lot of very large educational models. Any help anyone can give would be appreciated. Also please remember that I am not that familiar with Linux so please do not assume that I know how to find things or do things.
 
Old 04-17-2009, 04:12 PM   #2
pliqui
Member
 
Registered: Feb 2007
Location: Caracas, Venezuela
Distribution: Debian x64
Posts: 156

Rep: Reputation: 17
hello, u need to check somethings first.

1.- The USB drive is formatted in linux? (ext2, ext3, reiserfs, xfs, etc)

2.- Do you know how to mount the usb drive?

3.- The /home directory is in a different partition? and execute this command to check that
Code:
 cat /etc/fstab
You should see something like this
Code:
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/sda1       /               ext3    errors=remount-ro 0       1
/dev/sda5       none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto     0       0
do this at first so i can give you some pointers, because if /home directory if in a different partition you will need only to change it on fstab and will be easy, but before that we need to make sure that the USB drives boot automaticly.

Last edited by pliqui; 04-17-2009 at 04:18 PM. Reason: typos
 
Old 04-17-2009, 04:13 PM   #3
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
USB devices not being mounted at boot is a fairly common problem that has to do with the amount of time it takes the kernel to recognize a removable device in relation to the time it allocates for detecting them.

There are a number of ways in which you can fix this, but it is hard to say which one would be the best without a little more information on how Moodle starts and what your level of involvement is on how the server boots and works.

For instance, if the USB drive is put into /etc/fstab and simply isn't becoming active in time for it to be mounted, you could run the command "mount -a" after the machine has booted which will go back and mount everything in fstab (but this time the device would have had enough time to start).

If the server is something that is only powered up once and awhile this could be an acceptable solution, but more likely you would want to have this as a scripted event that happens a minute or so after boot.

Once the drive has mounted as /home, you would be able to log in with a normal user account. Before this you would be able to use the root account, or run the command through a script.
 
Old 04-18-2009, 11:11 PM   #4
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
Tell your husband to come home once and a while for kids sake.
Also, it is highly likely you can take the drive out of it's USB enclosure and install it directly into the old box, there is software that will allow an old computer to see and use a terabyte drive. All/most hard drive manufacturers offer this software for free, they all use Ontrack. Use "Ontrack disk management" as keywords in a Google search to find links to your hard drive manufacture's disk management page. Because if the USB drive will be permanently tethered to the computer as it contains the /home directory, save yourself some headaches and install it directly, you'll have the advantage of faster seek/transfer speed also.
Then move the home directory to it and add it to fstab and everything is normal.
This would be the best approach unless you need the drive to be portable. Hard drives are the cheapest form of storage these days.

Last edited by Junior Hacker; 04-18-2009 at 11:12 PM.
 
Old 04-19-2009, 03:46 PM   #5
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
Quote:
Also, it is highly likely you can take the drive out of it's USB enclosure and install it directly into the old box, there is software that will allow an old computer to see and use a terabyte drive.
As the computer is older, it is going to be using IDE while a 1 TB drive is almost certainly going to be SATA. You would need to use a PCI SATA controller to overcome this, but that would only be slightly better than over USB unless you got a pretty good controller (at a likely impractical cost). Installing and configuring said controller would also be considerably more difficult than using an external drive, and the goal here is to make this installation as simple as possible.

Though you don't need any special software to use a drive of that size with an older system. Assuming the drive interfaces were the same and you could physically connect the large drive to your system, Linux ignores the BIOS and directly queries hardware to get their specifications. The BIOS doesn't need to detect the drive for Linux to use it, in fact, you can disable all of your drives (other than the boot volume, obviously) in BIOS and the Linux kernel will pick them all right up.

The 137 GB limit is an issue with LBA addressing in BIOS and additionally some poor implementation on the part of Microsoft for older releases of Windows.

Last edited by MS3FGX; 04-19-2009 at 03:48 PM.
 
Old 04-19-2009, 06:20 PM   #6
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
Apparently that's the Windows experience talking.

Then add "mount -a" to /etc/rc.local, may even need to add a sleep time value ahead of it but probably not, I would just add the mount -a command and try it this way first. I would think commands in /etc/rc.local would be run before GDM logon screen appears.
Personally, if the computer can accommodate the drive, if it has SATA or the drive is actually IDE, or due to the low cost of new drives where you can purchase one to install into the computer, this would be a far better approach for a server. Servers generally run for extended periods of time. A computer has case fans, CPU fans, either/or or both, the point I'm getting at is that there is cooling in a computer where as there is none in USB enclosures. And if /home is going to be on this drive, it has to run whenever the computer is running.
 
Old 04-19-2009, 06:47 PM   #7
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
I would like to point out something.

Here at LQ we are constantly bombarded with cries for help to recover data from failed servers/computers. And most of these cases you'll find that the owner was pinching the all mighty dollar to start with, after the computer crashes is when they finally go out and buy other drives to do the backup they should have done before the computer crashed. What this means is that they actually could afford the drives all along as we've never heard of anyone telling us they were forced to make a loan in order to purchase them.

I'm only guessing here, but I have a feeling this terabyte drive was originally purchased with backup in mind, and because of it's size and the fact you don't need a terabyte for /home, now you are thinking of using it for both backup and /home, or just /home. One way or another, if this is your intention, due to obvious reasons, you may well end up shaking your head wondering why you did what most people tend to do...pinch the all mighty dollar.
 
Old 01-13-2010, 12:39 PM   #8
boune
LQ Newbie
 
Registered: Jan 2010
Location: Germany / Belgium
Distribution: Gentoo amd64
Posts: 4

Rep: Reputation: 0
Almost same problem, external device wan't mount on /home during startup.

Hi,

like stated in the title, I'm trying to mount an external USB drive on /home during startup. My internal drives becoming to small, I would like to use this external drive as /home that can travel too (and share my music and videos with friends). Backup for this drive will come after this problem will be resolved (rsync with another external drive, internal drives (2) containing multiple OSes and backup of my regular systems).

Device = LaCie Rugged 500GB USB2.0
with 2 partitions (a big one formated in ext3, a very small one formated in fat32 and containing ext2fsd.exe and equivalent for mac).

To prevent udev naming problems (not relying on sda1 and sda2 names) I created two rules in /etc/udev/rules.d/10-local.rules :

Code:
# LaCie Rugged (/LaCie_home)
SUBSYSTEM=="block", ATTR{partition}=="1", ATTR{start}=="63", ATTR{size}=="976703742" NAME="LaCie_home"

# LaCie Rugged (/LaCie_utils)
SUBSYSTEM=="block", ATTR{partition}=="2", ATTR{start}=="976703805", ATTR{size}=="64260" NAME="LaCie_utils"
I created a rule to test the mount at startup in my fstab file:

Code:
/dev/LaCie_home		/mnt/LaCie_home		ext3		defaults,auto,noatime	0 0
Obviously I created the corresponding /mnt/LaCie_home directory .

Now when my systems boots, I am having a warning telling me that a device could not be mounted because "/dev/LaCie_home" doesn't exist.

Like proposed earlier in this thread, I was about to add "mount -a" to /etc/rc-local. But there is no such a file on my system (a one year old Gentoo).

I tried to set
Code:
udev_settle_timeout="60"
, but it doesn't seams to change any thing to the boot process. And the warning still happens.

I tried to make the "/init.d/localmount" script depends on the "/init.d/udev" script but then udev isn't started at all...

Running out of ideas, I hope some one here is willing to help me

Thanks anyway.


boune
 
Old 01-14-2010, 07:03 AM   #9
boune
LQ Newbie
 
Registered: Jan 2010
Location: Germany / Belgium
Distribution: Gentoo amd64
Posts: 4

Rep: Reputation: 0
Hi,

since yesterday I found some (quirky) solutions...

I realized that most of the graphical login programs (xdm, gdm?, ...) propose to start some programs before/after run.
I use qingy (
Quote:
a replacement for getty. Written in C, it uses DirectFB to provide a fast, nice GUI without the overhead of the X Windows System
) and added this :
Code:
home="LaCie_home"

if [ -z "$(mount | grep $home)" ]; then

	mount /dev/$home

fi
to my "/etc/qingy/pre_GUI.sh" and changed my "/etc/fstab" so that my drive mounts on "/home/".

This works but still is a quirky solution. I really would like to have /dev/LaCie_home being created when udev populates /dev/ (I still have the warning during startup).

To prevent accidental unmount from my filer (PcmanFM) which shows (thanks to hald and like almost every filer) usb drives an make mounting and unmounting them easy, I added to "/usr/share/hal/fdi/policy/10osvendor/" following file (99-LaCie_homeDir) :
Code:
<?xml version="1.0" encoding="UTF-8"?>

<deviceinfo version="0.2">
  <device>
    <match key="info.udi" string="/org/freedesktop/Hal/devices/volume_uuid_########">
      <merge key="volume.ignore" type="bool">true</merge>
    </match>
  </device>
  <device>
    <match key="info.udi" string="/org/freedesktop/Hal/devices/volume_uuid_########">
      <merge key="volume.ignore" type="bool">true</merge>
    </match>
  </device>
</deviceinfo>
To make those changes take effect immediately type :
Code:
/etc/init.d/hald restart
Voilą, sorry for those who use xdm, gdm or alike, I really don't know which file/script to modify to mount your /home/ correctly.

If ever someone knows how to force /dev/LaCie_home to be created by udev when populating /dev/ I will be happy to learn how to... (I will try to force it manually).

Thanks any way.


Boune
 
Old 01-14-2010, 07:42 AM   #10
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
For removable drives, I would recommend using the UUID number in the first column of your /etc/fstab entry. You can't rely on the device being named the same each time.

With the device plugged in, list the device nodes in /dev/disk/by-uuid.
ls -l /dev/disk/by-uuid/

example:
Code:
 
ls -l /dev/disk/by-uuid/

rwxrwxrwx 1 root root 10 2010-01-12 15:43 145266D35266B95E -> ../../sda2
lrwxrwxrwx 1 root root 10 2010-01-12 15:43 14D23645D2362AFE -> ../../sda1
lrwxrwxrwx 1 root root 10 2010-01-12 15:43 21a3c26d-0927-494a-b429-e7c613237525 -> ../../sda7
lrwxrwxrwx 1 root root 10 2010-01-12 15:43 283c3ee4-2909-4ab7-b0a5-dd289c212873 -> ../../sdb2
Suppose that the third result is what I want. The first column of the /etc/fstab entry would then be:
UUID=21a3c26d-0927-494a-b429-e7c613237525

Using udev to give the filesystem a special name isn't necessary.

---
One thing to consider is to mount the filesystem in a directory inside your home directory. Then if it didn't mount automatically, you can do so manually before using moodle.

You could mount it in a subdirectory and then move some of your files already present to the external drive, leaving room for moodle files in your normal home directory.

Last edited by jschiwal; 01-14-2010 at 07:43 AM.
 
1 members found this post helpful.
Old 01-15-2010, 04:20 AM   #11
boune
LQ Newbie
 
Registered: Jan 2010
Location: Germany / Belgium
Distribution: Gentoo amd64
Posts: 4

Rep: Reputation: 0
Hi jschiwal,

and thanks for your post.
The UUID hint is a good one in comparison with my udev.rules
But even this way I still have the annoying warning when booting up : "mount: special device UUID=####### does not exist" and the drive will not be mount during startup. It is like my drive is "not attached" during the whole booting process, I really don't understand what is happening...

So, now I target my drive with his UUID in my "fstab" file.
My "pre_GUY.sh" still looks like this :
Code:
if [ -z "$(mount | grep /home)" ]; then

	mount /home

fi
because this :
Code:
home_uuid="#######"
if [ -z "$(ls -l /dev/disk/by-uuid/ | grep $home_uuid)" ]; then

	mount UUID=$home_uuid

fi
doesn't work... Which is a bit annoying

I removed the udev.rules. "Hal foo.fdi rules" stays to prevent unfortunate GUI (un)mount. This make my system neater, but still not perfect , I still hope being able to mount this external drive during boot time...

Have a nice day, and still thanks for your suggestions.


Boune

Last edited by boune; 01-15-2010 at 04:56 AM.
 
Old 01-15-2010, 02:10 PM   #12
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware 14.1 (multilib) with kernel 3.13.2
Posts: 1,484
Blog Entries: 11

Rep: Reputation: 154Reputation: 154
I too have an older machine and mount an external drive at boot time, albeit for backup, not as /home.

I have the mount command in an initrd that gets loaded at boot time. In slackware it is pretty straight forward to modify/create an initrd; you probably know how to do that in Fedora or Gentoo. It's probably easier than messing with HAL and udev though not as elegant or flexible to be sure.

Last edited by mostlyharmless; 01-15-2010 at 02:11 PM.
 
Old 01-15-2010, 03:16 PM   #13
rich_c
Member
 
Registered: Apr 2008
Location: UK
Distribution: Mepis; Maemo; openSUSE
Posts: 384
Blog Entries: 74

Rep: Reputation: 81
Have a read of this for a strategy that might be adaptable to your situation. Basically, keep /home where it is and create links from it to where your data really is.
 
Old 01-20-2010, 06:17 AM   #14
boune
LQ Newbie
 
Registered: Jan 2010
Location: Germany / Belgium
Distribution: Gentoo amd64
Posts: 4

Rep: Reputation: 0
Thanks for those two suggestions.

About what /home is supposed to be, even if I understand it, for some irrational reasons I will stay to my first decision.
About adding a script to /etc/init.d , I don't think this is the solution. The problem seems to be that my drive is not up when udev is populating, and even when "localmount" (an init script) is run the drive has not been recognized. But when a forced fscheck occurred during boot, the "UUID=##### drive not found" warning didn't happen. So I suppose that it is all about time to startup my drive, or to populate completely /dev by udevd.
There is an udev option in /etc/conf.d/udev which should delay the process of uevents at boot "udev_settle_timeout" which default is 60. Assuming that it would be seconds, I tried to delay for about 10 minutes just to see what happens. Result, nothing, the boot process don't even seems to be interrupted. And I don't find any documentation or anything about what this option should really do.

Honnestly, I am not desperate, my system boots fine, my pre_GUI.sh script takes care of my mounts ect.. But It would be nice to understand what is happening... Any clues?

Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Having problems moving home directory to second drive. coldbeer Slackware 4 02-08-2008 10:38 PM
Syncing your home directory on a USB Flash Drive neville310 Linux - Desktop 1 01-13-2007 05:30 AM
external enclosure for an internal hard drive vs external USB hard drive powah Linux - Hardware 1 03-10-2006 09:03 AM
using flash drive for /home directory? tuneout Debian 3 01-01-2006 07:22 AM
XS Drive II external USB hard drive/card reader max74 Linux - Hardware 7 10-21-2003 10:41 PM


All times are GMT -5. The time now is 09:38 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration