PDA

View Full Version : Linux - /home/me on a portable HDD?



personthingy
10-03-2006, 05:29 PM
Hello peoples,
I'm wondering if i can avoid alot of complications by running /home/me on a portable HDD?

My ex laptop HDD is now travelling with me, USB cable attached, and i figure that if i can get both my machine, and the one i am a frequent guest on to recognise sda1 as /home/me , then i can save alot of hassle.

Mepis comes close to offering what i want with the "on the go" username, which effectively, from what i can gather, is "CDRW disk = /home/on the go"

I'm not sure if this is a new Mepis thing, or a new KDE thing, but it is teasingly close to being exactly what i want.

Unfortunatly there was no option to make an on the go disk on anything other than a CDRW :(

So anyways..... What does one have to do to make /home/me work from the portable USB HDD? Are there any drawbacks to this, apart from the obvious that if i lose my portable HDD, i will be back to the last backup of /home/me ?

vinref
11-03-2006, 12:33 PM
Edit the fstab. Something like

/dev/??? /home ext3 rw 2 2

Drawback is that you must remember to plug the USB at boot otherwise init gets very confused.

Graham L
11-03-2006, 12:44 PM
There is no problem ... except potential confusion. You can mount any disk or directory (with loopback) using /home/me as the mount point. Whatever is in that (mount point) directory disappears as long as the other is mounted. All operations are performed on the mounted directory.

You don't need to change /etc/fstab, though this will enforce the presence of the external device on your "home" computer. It might be best not to on computers other than your two. You can use the mount command as required.

vinref
11-03-2006, 12:59 PM
There is no problem ... except potential confusion. You can mount any disk or directory (with loopback) using /home/me as the mount point. Whatever is in that (mount point) directory disappears as long as the other is mounted. All operations are performed on the mounted directory.

Irrelevant to the original question.


You don't need to change /etc/fstab, though this will enforce the presence of the external device on your "home" computer. It might be best not to on computers other than your two. You can use the mount command as required.

Try booting without a valid /home and see what happens. Init must know where the /home is, otherwise it may just boot in the root account or worse. The only ways to do this is via the fstab, or of course, by passing an option into the boot routine, such as boot: /home = /dev/???. The fstab is much easier.

Graham L
11-03-2006, 01:27 PM
Sorry. Highly relevant. That's what Chris wants to do.

Who needs a "valid /home" to boot? It's a bit essential to have a home directory, such as /home/chris for chris to log in. But the OS doesn't need users, or user home directories to start up. It doesn't "boot in the root account or worse". How would it do that? Linux does what it's told. It just puts up a login prompt on my machines. Wimpy GUI users might have problems, though I'm sure that would just start X Window, and put up a login prompt page. It won't need a home directory until it is told which user want to log in. :D Anyway, there is one. Chris wants to mount another device on his home directory -- referred to as "/home/me" . That's the mount point for his external device. That directory would have the standard '.' files put in it when the user was created. If the external isn't there, it will happily allow "me" to log in, and use the files present there. If the external has been mounted, "me" can log in and use the files on it.

It is perfectly legal and reasonable to log in as root, mount the portable disk, then log in as a "user". It's not essential to have an entry in fstab.

Myth
11-03-2006, 02:14 PM
Sorry. Highly relevant. That's what Chris wants to do.

Who needs a "valid /home" to boot? It's a bit essential to have a home directory, such as /home/chris for chris to log in. But the OS doesn't need users, or user home directories to start up. It doesn't "boot in the root account or worse". How would it do that? Linux does what it's told. It just puts up a login prompt on my machines. Wimpy GUI users might have problems, though I'm sure that would just start X Window, and put up a login prompt page. It won't need a home directory until it is told which user want to log in. :D Anyway, there is one. Chris wants to mount another device on his home directory -- referred to as "/home/me" . That's the mount point for his external device. That directory would have the standard '.' files put in it when the user was created. If the external isn't there, it will happily allow "me" to log in, and use the files present there. If the external has been mounted, "me" can log in and use the files on it.

It is perfectly legal and reasonable to log in as root, mount the portable disk, then log in as a "user". It's not essential to have an entry in fstab.Would not his choice of Desktop Environment also be of importance? I think he mentioned he uses KDE right, which in turn uses kdm by default to signin. KDE hates root logins and will need a home account before it will allow a user signin. IIRC :)

ILikeLinux
11-03-2006, 02:22 PM
Another option is to install a linux distro in the usb hard disk, along with a bootloader. This is only an option if both the computers allow you to boot of a usb HDD, and if your Hard Disk is big enough. Also the advantage with this is that you can perform updates to the system without burning another cdrom.

This is just an alternative - just giving ideas ;)

Graham L
11-03-2006, 02:46 PM
... KDE hates root logins and will need a home account before it will allow a user signin.
So? Tough. Linux will boot. A real OS doesn't need users to boot.

The account exists. That's independent of the user's home directory, (which doesn't have to be in the /home tree ... it can be anywhere it's been put.) The OS is told where in the /etc/passwd entry for the user.

Sure, KDE, Gnome, etc need the "dot"files in the user's directory to see configuration. bash, and other command line interpreters, will probably run happily on its defaults.

You could log in as a user, using the "fixed" home directory, then mount the external disk over it. It probably wouldn't crash. :D

However, thinking about it, I would not do it exactly like this. There are various files which are updated (invisibly) in the user home directory. I think I would make another directory (mount point), say, "/portable" and mount the external disk to that. Then in the user's login script, have a couple of lines to mount the external disk, and if that has been successful, "cd /portable". That way, the system can do what it wants to do in the user's home directory, and all other files live in the portable directory. (I suppose, for "consistency", the mount point could be put in the /home tree, but without creating a user of that name. ) (Or even /home/me/portable :D)

personthingy
11-03-2006, 03:05 PM
Would not his choice of Desktop Environment also be of importance? I think he mentioned he uses KDE right, which in turn uses kdm by default to signin. KDE hates root logins and will need a home account before it will allow a user signin. IIRC :)Latest version of mepis seems to be quite happy to allow root logins, although the highly updated versions before it progressivly found more and more ways to refuse graphical login as root....

And yes Mepis comes with KDE, and thats what i prefer to use.

personthingy
11-03-2006, 03:16 PM
Anyway... putting aside if it's possible... lets assume that it is, so back to the original question....

I'd like 2 machines to both be able to see /sda1 as /home/me... or some variation on that theme..

What do i have to change to make this so, preferably done in such a way that i simply plug in the USB HDD, and log in as user "me" and the system will allways go happily to /sda1 as the space where /home/me gets its files from?

What exactly must i edit and where?
Somewhere in the debate over if it would work, i've totally failed to grasp what i must change to try this concept.


:confused:

personthingy
11-03-2006, 04:08 PM
Coming at you logged in as "personthingy" whose files live on /mnt/sda5/personthingy , instead of the usual and predictable /home/personthingy

So far there seems to be no problem, although it will be interesting when i go home in a couple of days to see what my computer has to think about using /mnt/sda5/personthingy as a location for the new users files

I'm just going to reboot, just to see what the system thinks of logging "personthingy" into /mnt/sda5/personthingy, when up to now that partition wasn't mounted unless i told the system to do so..


la la la la la

personthingy
11-03-2006, 04:19 PM
And we have the predictable problem..
sda5 is not mounted, so without the users files, i am returned to the log in screen, where i must log in as root, and then i must mount /mnt/sda5, log out, and finaly log in as personthingy, this time successfully

So far i have found no issues with anything not working as per normal, apart from the above.

Is there a way to tidy away this small issue of sda5 not being mounted by default?

personthingy
11-03-2006, 04:23 PM
Another option is to install a linux distro in the usb hard disk, along with a bootloader. This is only an option if both the computers allow you to boot of a usb HDD, and if your Hard Disk is big enough. Also the advantage with this is that you can perform updates to the system without burning another cdrom.

This is just an alternative - just giving ideas ;)Yes this might work if i thought i was only ever going to be the only user of this box under *nix.... however, i would like this machine to work as a *nix box without the USB HDD, as i am ever hopeful that those who live here might at some stage play :D

Graham L
12-03-2006, 12:58 PM
Chris, I think the best way wil be to do it this way.

Always log in using the /home/personthingy "permanent" directory. That will always work. It will let the system use that directory for its "notes", and other things it needs to remember between sessions (which might differ between computers). So you're doing everything in a standard way as far as the system's concerned.

If your external disk is a USB, it can be set up to be automatically mounted (possibly to /mnt/removable by default) if it's plugged in when you boot, or when it's plugged in. (I've had trouble stopping this from happening sometimes. :D )

Make a softlink to that mount point in /home/personthingy. (Or make a mount point in /home/pt and change the fstab entry accordingly. That's less desirable, because the damn user-fiendly stuff [kudzu etc] can change fstab without asking you.) I'd use a softlink.

This way you'll have to do a CD (or mouseclick) to get to the portable directory, but you'll find it automatic after a couple of times. But it will work. Guaranteed. No unexpected oopses. And it won't affect anyone else. If you arrive somewhere without the external disk, you can still do things in your own directory.

personthingy
15-03-2006, 06:26 PM
Well..
the result of the expererment.....

I now have access to 2 computers that see "personthingy"'s home as /mnt/sda5/personthingy

I've set the acount # to 1111 as thats high enough that i probably won't encounter it elseware, but is easy to remember. I need to log in as root to ensure sda5 is indeed mounted, and then i log in as "personthingy"

So far there are NO problems other than amerok, my media player looks in /Music and there's a different collection on the different host machine. This causes some small hickups. I imagine there will be similar errors with missing progs and the likes.

In essence its a success, i carry "me" in a portable HDD the size of a ciggerette packet, and all my mail, my bookmarks and most used stuff are with me.

I can see no reason why it couldn't be done on a pen drive.
:D
me chuffed