1

I'm new to Elementary OS and Linux in general (other than my ASUS router and some use of a Raspberry pi), and I have a cheap Dell Inspiron 14 3473 laptop with a measly 32GB HDD. I successfully installed Elementary OS and everything is working really well.

So, I'm wondering if I can save documents, videos, pictures, and music, as well as install apps to my 64GB USB Drive? Windows gives the option to install Apps to a USB drive rather than C drive, does Elementary OS allow the same thing?

Thank you for any help or suggestions.

2 Answers 2

0

I do not know about apps, but for sure you can save documents, videos, pictures, and music on any drive connected and recongnized by the OS.

0

There are several ways you could approach this. As Bo stated you can just keep your personal files on an external drive but in that case applications that look for these files or store files (Downloads for example) in your home directory will not automatically find them and they will not show up by default in the Files sidebar.

What I would recommend is copying your existing home directory to your USB drive and mount your home directory to it. This will work seamlessly for your personal files as well as application configuration files and the bulk of Flatpak apps (7.9 GB on my system) but it won't move apps installed in system folders. If this approach is what you want you can follow the steps below.

WARNING: I was able to verify that this works on my laptop. If you stick to the commands you shouldn't create any irreversible issues. The only irreversible command is rm so use it with caution. Read through the guide before executing and make sure this is something you are comfortable with.

  1. Create a new elementary OS administrator user in system settings (you can remove this user when you are done if you choose)
  2. Log into the new user account and make sure your USB drive is inserted and mounted
  3. Open a terminal window and open a shell as root with the command:

    sudo -i

  4. Make sure your USB drive is mounted then copy the contents of your primary users home directory over to the USB drive

    NOTE: You will need to replace [username] with the primary username, [temp username] with the username of the temporary user you are logged in with and [usb drive name] with the name of the usb drive which you can find it by executing ls /media/[temp username]. Substitute these values in this and all of the remaining steps. Replace everything between the square brackets AND the brackets themselves.

    cp -rp /home/[username]/* /media/[temp username]/[usb drive name]/

  5. Browse the USB drive and verify that everything was copied

  6. Move the original home directory to a new location so that you can reverse this if necessary

    mv /home/[username] /home/[username]_bak

  7. Create a directory to mount to, change the owner, and prevent the directory from being written to when not mounted with the three commands:

    mkdir /home/[username]
    chown [username]:[username] /home/[username]
    chattr +i /home/[username]

  8. Find the UUID of your USB drive with the command

    blkid

    NOTE: You should see all of your drives and partitions listed if you are unsure which drive it is type df -Th and look for the drive with the size matching your usb drive. Jot down the /dev/... identifier for the drive then run blkid again and find the matching /dev/... line (e.g. /dev/sdb).

  9. Copy the UUID value to the clipboard (only the characters between the quotes following UUID=)

  10. Create the mount in fstab so it will auto mount on boot. The settings for the mount will allow the mount to fail and still boot for other users if the drive is not inserted or is corrupted, however you will not be able to log into the primary user account if the mount does not succeed (login screen loop). If this happens and you don't have a second administrator account you will have to use a live disk to repair the user profile which is a good argument for keeping the new admin user around.

    echo "# External home drive" >> /etc/fstab

    Followed by (one line, make sure to paste in your UUID and username):

    echo "UUID=[paste your UUID here] /home/[username] auto defaults,nofail,x-systemd.device-timeout=9 0 1" >> /etc/fstab

  11. Mount the drive with mount -a and see if your files are there ls -a /home/[username]. If not go through and review the steps again.

  12. Log out and log into your primary user, validate that it works and if not log back into the temporary user and back out the change with the three commands:

    sudo -i
    rm /home/[username]
    mv /home/[username]_bak /home/[username]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.