LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 03-21-2016, 05:06 AM   #1
Cyberman
Member
 
Registered: Aug 2005
Distribution: Debian Stable
Posts: 218

Rep: Reputation: 17
Symlinking $HOME to a USB?


MMmmm hmm.......

distro: 15.10

I'm making a persistent USB work-around due to unetbootin and YUMI both sucking really hardcore and not giving me a persistent Live USB. I do not think that I can USB a $HOME dir unless I'm going to root in a tty, right? Because doing something like that might break Unity while I'm in it while in Live, right?

That's why I'm also leaving the alternative: Everything in $HOME is on the USB rather than $HOME itself. So, $HOME stays where it is, but anything that would go in $HOME would go into the USB. $HOME stays a local directory but whatever goes in $HOME would go into like a false $HOME on the USB.

So, /home/it/ would still exist, but when something goes in there, it would actually go into /media/it/47something/root/home/

What I'll be doing is booting up a Live 15.10 Ubuntu, launching setup.sh in gnome-terminal "#bash ./setup.sh", and having the symlinking occur from there. That way, if I do something like hit prt scr, then it takes a snapsot, and when I save to what would look like /home/it/Pictures(?)/screenshots(?)/, then it would actually save in /home/it/47something/root/home/Pictures/screenshots


And I think I would be symlinking them somehow. However, I cannot recall how to symlink this kind of stuff.

Last edited by Cyberman; 03-21-2016 at 05:09 AM.
 
Old 03-25-2016, 12:24 AM   #2
DaneM
Member
 
Registered: Oct 2003
Location: Chico, CA, USA
Distribution: Linux Mint
Posts: 881

Rep: Reputation: 130Reputation: 130
I'm having a little trouble understanding what you're after. Are you booting from an Ubuntu installation on the internal hard drive, or from a live USB drive? Where do you want the data stored in $HOME to end up: on the internal hard drive or USB? Are you trying to set up a non-persistent installation that boots from the internal hard drive, but only stores things in $HOME when the user plugs in a USB drive? More to the point, what do you want the user to be able to change, and what do you want to get erased when you reboot?
 
1 members found this post helpful.
Old 03-27-2016, 05:46 PM   #3
Cyberman
Member
 
Registered: Aug 2005
Distribution: Debian Stable
Posts: 218

Original Poster
Rep: Reputation: 17
Ok, I'm editing this post:

I'm having a little trouble understanding what you're after.
q: Are you booting from an Ubuntu installation on the internal hard drive, or from a live USB drive?
a: Live USB

q: Where do you want the data stored in $HOME to end up: on the internal hard drive or USB?
a: A different USB drive, such as a 512MB drive

q: Are you trying to set up a non-persistent installation that boots from the internal hard drive, but only stores things in $HOME when the user plugs in a USB drive?
a: No, the Live USB is booting from a 4GB USB drive

q: More to the point, what do you want the user to be able to change,
a: $HOME is now on a separate USB rather than the RAM $HOME (there is a proper name for this, and I don't really recall casper, rw-ram, and all that crazy RAM crap)

---> I understand this might burn out the USB drive due to the amount of writing. At the bare minimum, I want to know how I could pull this off. But I think the more ideal situation would be having stuff NOT like Mozilla (caching ought to have a TON of writing) on the USB ./home and everything else on the USB. If anyone wants to help tackle this issue at the same time, that'd be grrrrrreat!

q: and what do you want to get erased when you reboot?
a: Not the $HOME that would then exist on, say, the 512MB USB drive.

One of the things about this is that I'm not sure symlinking is the answer. That might cause some "tunnelling latency" or whatever a proper term might be for it: It creates a middleman that may slow things down.

Last edited by Cyberman; 03-27-2016 at 06:13 PM.
 
Old 03-28-2016, 08:30 PM   #4
Cyberman
Member
 
Registered: Aug 2005
Distribution: Debian Stable
Posts: 218

Original Poster
Rep: Reputation: 17
*edit*

I'm going to wait for responses.

Last edited by Cyberman; 03-28-2016 at 08:36 PM.
 
Old 03-29-2016, 07:18 AM   #5
TxLonghorn
Member
 
Registered: Feb 2004
Location: Austin Texas
Distribution: Mandrake 9.2
Posts: 702

Rep: Reputation: 231Reputation: 231Reputation: 231
First, a 512 MB USB drive is not big enough to store even one screenshot.
Second, your live OS will not remember mount points or symlinks from one boot to the next.
You can install your OS to the 4GB USB drive in the same way you install to a hard drive. That seems to be your best option.
 
Old 03-30-2016, 01:59 AM   #6
DaneM
Member
 
Registered: Oct 2003
Location: Chico, CA, USA
Distribution: Linux Mint
Posts: 881

Rep: Reputation: 130Reputation: 130
Correction regarding USB drive size: a single image can be expected to take up ~5MB. 512MB is tiny, by today's standards, but it's enough to hold a good number of images, and a whole lot of text files. If you're not doing much more than that, it should be fine...although there's no telling how much space the system stuff in $HOME might take up, eventually, and you can get a 16GB drive for under $10 (USD), if you shop around. :-)

First, let's see if we can write to the second USB drive as $HOME by symlinking it in a live environment. A noteworthy challenge will making sure that all the necessary files to run Unity and whatnot will be in the right place, and don't cause errors.

It's important that you format the second USB drive to ext2, ext3, or ext4, so that it will support Linux permissions. FAT, exFAT, HFS, HFS+, NTFS, etc. won't work for this.

Boot into the live environment, and plug in the USB drive. Then type this into a terminal. Post any errors or other output that seems noteworthy. (Stuff after a "#" is a comment, and should not be typed, but it won't hurt anything if you do type it.)

Code:
sudo blkid
# note the device node--like /dev/sdXY--of your second USB device and its main partition
sudo umount -f /dev/sdXY # replace XY with the appropriate letter and number
sudo mount /dev/sdXY /mnt
sudo cp -vfrp /home /mnt/
sudo mv /home /home.old -vf
sudo ln -s /mnt/home /home
At this point, you should have /home symlinked to the corresponding directory on the second USB drive, which is mounted at /mnt. The original /home has been copied there, with permissions intact...hopefully. Try opening /home/<username> in a file browser and messing around, a bit. Can you create, delete, execute files as normal? If so, you should next try restarting X. If this works, /home has almost certainly been migrated successfully. If not...we still have something to figure out.

To restart X, press CTRL+ALT+F1 to switch to a TTY terminal. In that terminal, type:
Code:
sudo lightdm stop
sudo lightdm start
(This assumes that the version of Ubuntu you're using makes use of the LightDM display manager. If not, you'll have to look around for the correct one and restart its service.)

Does X come up and work properly? If so, great! All that's left is to automate the above with some clever scripting and possibly a live image customization (the latter is a pain, and should be avoided, if possible). If not, post back any error messages you get, including the output of `dmesg` and `cat /var/log/syslog` (and anything else that might seem relevant).

It should be noted that, using the above method, you'll have to re-copy home to the second USB drive every time you boot, possibly erasing stuff you care about. It's not a complete solution, yet.

Last edited by DaneM; 03-30-2016 at 02:02 AM.
 
Old 03-30-2016, 09:27 AM   #7
TxLonghorn
Member
 
Registered: Feb 2004
Location: Austin Texas
Distribution: Mandrake 9.2
Posts: 702

Rep: Reputation: 231Reputation: 231Reputation: 231
DaneM is right, of course - 512 MB will hold quite a few documents.
But, Cyberman, you have a 4 GB drive that probably holds nothing more than the live operating system. That means that you have about 2.5 GB space that you can use on that drive, if you create a persistent file or partition.
https://help.ubuntu.com/community/LiveCD/Persistence
 
1 members found this post helpful.
Old 03-30-2016, 10:51 PM   #8
DaneM
Member
 
Registered: Oct 2003
Location: Chico, CA, USA
Distribution: Linux Mint
Posts: 881

Rep: Reputation: 130Reputation: 130
Yes, as TxLonghorn suggests, that's a much simpler solution. :-) It's only really worth messing with changing $HOME to a separate drive if you want to be able to put different users' home directories on different USB drives.
 
Old 04-03-2016, 04:32 PM   #9
Cyberman
Member
 
Registered: Aug 2005
Distribution: Debian Stable
Posts: 218

Original Poster
Rep: Reputation: 17
Isn't symlink going to act as a middleman, thus causing a data transfer bottleneck?

The persistence issue is broken. Hey, feel free to tell me if you can get YUMI or unetbootin to install Ubuntu 15.10 with persistence on it.

Last edited by Cyberman; 04-03-2016 at 04:36 PM.
 
Old 04-07-2016, 12:36 AM   #10
DaneM
Member
 
Registered: Oct 2003
Location: Chico, CA, USA
Distribution: Linux Mint
Posts: 881

Rep: Reputation: 130Reputation: 130
Question

Symlinks don't seem to cause any noticeable amount of speed reduction.

http://stackoverflow.com/questions/1...erformance-hit

I think the bigger issue is trying to find a way to accomplish the OP's goals in a way that isn't a total pain in the rear. I've had some issues with persistence, too; but other solutions are going to involve a whole lot of "duct tape". I'm not entirely sure what the best solution is.
 
Old 04-08-2016, 05:58 AM   #11
TxLonghorn
Member
 
Registered: Feb 2004
Location: Austin Texas
Distribution: Mandrake 9.2
Posts: 702

Rep: Reputation: 231Reputation: 231Reputation: 231
You might be able to use these instructions to bind the $HOME directories in your script.
 
1 members found this post helpful.
Old 04-09-2016, 04:53 AM   #12
TxLonghorn
Member
 
Registered: Feb 2004
Location: Austin Texas
Distribution: Mandrake 9.2
Posts: 702

Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Originally Posted by Cyberman View Post
The persistence issue is broken. Hey, feel free to tell me if you can get YUMI or unetbootin to install Ubuntu 15.10 with persistence on it.
I don't know about Ubuntu 15.10 specifically, but the trick with unetbootin is to create a small persistent casper-rw file of about 100 MB (ext2). The operation will fail if you try to create a huge casper-rw file.
You create a fat32 partition just big enough for the live Ubuntu, and a second ext2 partition, giving it the Label "casper-rw". The casper-rw file can then be deleted.
I know that sounds like a strange procedure, but that it how it is done.
Here is a tutorial using Mint(based on Ubuntu)

Last edited by TxLonghorn; 04-09-2016 at 04:57 AM.
 
1 members found this post helpful.
  


Reply



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
[SOLVED] Apache and Symlinking to /home/ bhughesshelton Linux - Server 3 03-10-2016 02:47 AM
Corn Recursive symlinking Ktl_XV Linux - Server 2 05-10-2010 09:40 PM
symlinking firefox dr_zayus69 Linux - Software 2 02-28-2005 03:20 AM
symlinking smbfs across a wan jse580 Linux - Networking 1 02-27-2004 01:21 AM
symlinking /opt to /usr/? [GOD]Anck Slackware 6 01-01-2004 11:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 09:36 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration