1

I've been using linux on a USB stick with persistence. I have been thinking about finally installing it to an internal drive.

I was wondering if there is any way I can install to the drive and also keep the applications and their data which is present on my USB stick.

Digging a little, I found that persistent linux just stores all installed files in a separate partition. Is there an automatic way of getting these applications and data to my internal drive? If not, what how difficult would it be to pick and choose the right files to copy and paste manually?

Update: I am using Ubuntu 20.04 on the USB drive. Software is mostly from apt or flatpak. I did not specify these earlier because an ideal solution will be something that perhaps works at a system level (copying the directories like /etc from casper-rw to the installation target directly, as it is already copying these directories from the ISO image to the install target)

2
  • If the downvote can be explained, I could try improving the question Jun 30, 2020 at 11:16
  • Also curious about this. Thinking of it like a poor-mans clone -- i.e. creating USB image and installing it locally on several machines. May 8, 2021 at 7:52

1 Answer 1

1

If you have installed applications using the distribution's standard package manager, you should just get a list of all packages currently installed. There is certainly a command-line tool you can use to pipe such a list into a file:

  • with RPM-based distributions, rpm -qa >package-list.txt usually works
  • with distributions using .deb packages (Debian, Ubuntu and their derivatives), dpkg --get-selections >package-list.txt should work.

Then once you have your regular installation, go through that list and use the package manager to select those same packages for installation, and you'll have the exact same software installed the exact same way.

If you have installed software by compiling it from source yourself, or using third-party installers, you'll be on your own with them. If the software is installed exclusively in /usr/local or /opt, it is very much possible that you can just copy the application's directory subtree (or even the entire /opt or /usr/local subtree) from your USB-installation to the internal one. But if the installer e.g. registers MIME types to the desktop environment by adding file to system directories, you might need to reproduce those too.

For the data, this is precisely why the concept of user home directories exists: you should be able to e.g. zip or tar your entire /home directory and unpack all of it to your new installation. You might also be able to copy them straight from one installation to the other, but depending on how the USB-based installation implements persistence, there might or might not be some complications.

(You did not say which Linux distribution you're using, so it will be hard to give more specific advice than this.)

4
  • Essentially, this is no different than the process you would follow for copying your applications and data from one linux system to a different one, right? Jun 30, 2020 at 11:17
  • Yes, the same procedure would be applicable in that case too.
    – telcoM
    Jun 30, 2020 at 14:35
  • But what about the software configuration? Would it be possible to migrate the software with its configuration, instead of installing all software anew? For example, migrating all of UFW rules automatically?
    – flen
    Apr 13, 2022 at 21:11
  • @flen If a piece of software has per-user configuration, it is often stored within the user's home directory, and gets transferred along with it. System-wide configuration, on the other hand, is typically stored within /etc: if you install the same version of the same distribution to the new system, you could backup the /etc directory tree of the old installation and restore it to the new one after all the packages have been installed. But being more selective than that helps to leave out obsolete stuff from the old installation; understanding what you restore also helps troubleshooting.
    – telcoM
    Apr 14, 2022 at 9:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .