Linux Environment Variables: Exploring File System Storage

In summary, it is possible to back up an entire hard disk on an external disk provided that the external disk is formatted to the same file system used by the main drive, the external drive has enough space to accommodate the files, and that a disk cloning program is used.
  • #1
Simfish
Gold Member
823
2
system?

I know that it isn't possible in Windows since Windows has the registry and background variables that aren't stored on the file system for some reason.

But what about Linux? Are its environment variables stored on the file system? Is there anything that isn't stored on the file system? Is it possible to even backup a software installation by copying the software's directory from one computer to another? If it's not possible, then why not?
 
Computer science news on Phys.org
  • #2


There are a few special files like those in /dev which aren't really files and symbolic links but the unix copy utilities know about these and can copy (or recreate) them correctly
 
Last edited:
  • #3


It is actually possible to back up an entire hard disk on an external disk provided that the external disk is formatted to the same file system used by the main drive, the external drive has enough space to accommodate the files, and that a disk cloning program is used. The disk cloning program has a special function that overrides the security fail safe that prevents running processes on the computer from having the running files copied, this way a complete copy of the contents of the drive can be made on a backup disk. A list of disk cloning software can be found here:

http://en.wikipedia.org/wiki/Comparison_of_disk_cloning_software

It is recommended that the freeware or the General Public License software be downloaded because they are free and they have the same functionality as the proprietary software. After installing the disk cloning program, it is recommended that a virus and malware scan be run first to eliminate any security threats on the main drive so that they do not get copied into the external drive. It is also recommended that a disk cleanup be run to eliminate any garbage or ghost files, a defragmentation to cluster files together and eliminate needlessly occupied volume to decrease the overall size of the files, and an error check to fix or eliminate bugs which also occupy space on the hard drive. Afterwards, it is also recommended that all unnecessary processes be deactivated via the task manager and that the process priority for the disk cloning program be set to maximum to accelerate the copying of the files. The disk cloning program takes an average of 1 hour to complete the transfer of files to the external drive.
 
  • #4


Another option is to have a second hard drive with a second instance of an OS installed for backup and restore purposes. I have 2 hard drives, each with multiple partitions, each with a copy of windows installed, Windows XP 32 on one, Windows XP 64 on the other (I sometimes do some 64 bit programming). Each OS can backup the other OS partition with a simple drag and drop copy, although I use a program I wrote that also copies the short file names (this is probably not needed anymore). Then I use windiff to compare the backup partition as a verify step.

I assume the same process would work for Linux, just install it twice, on a partition on each hard drive.
 
  • #5


In Linux, environment variables are indeed stored on the file system. They are typically located in the /etc/profile file or in the ~/.bash_profile or ~/.bashrc files for individual users. These files are read and executed when a user logs in, allowing for the customization of the user's environment.

There are some variables, such as the PATH variable, that are set by default by the system and are not stored on the file system. These variables are essential for the system to function properly and are typically set in the /etc/environment file.

As for backing up a software installation by copying the software's directory, it is possible in some cases but not recommended. This is because software installations often have dependencies and configuration files that are not stored in the main installation directory. Simply copying the directory may result in a faulty installation. It is always best to use the appropriate package management system to install and manage software in Linux.

Overall, the Linux file system is highly customizable and flexible, allowing for the storage of environment variables and other system configurations. However, it is important to use proper methods for managing and backing up software installations to ensure a stable and functioning system.
 

1. What are environment variables in Linux?

Environment variables are dynamic named values that can affect how processes behave in a Linux operating system. They are used to store information that can be accessed and modified by programs and scripts.

2. How are environment variables set in Linux?

Environment variables can be set either temporarily or permanently. Temporary variables are set using the export command in the terminal, while permanent variables are set in configuration files such as .bashrc or .profile.

3. What is the purpose of using environment variables in Linux?

Environment variables are used to store data that is needed by various programs and scripts. They can also be used to customize the behavior of the system, such as setting the default editor or language.

4. How can I view all the environment variables in Linux?

To view all the environment variables in Linux, you can use the printenv command in the terminal. This will display a list of all the current environment variables and their values.

5. Can environment variables in Linux be modified?

Yes, environment variables in Linux can be modified using the export command or by editing the configuration files. However, it is important to use caution when modifying these variables as it can affect the behavior of the system and programs.

Similar threads

  • Computing and Technology
Replies
24
Views
7K
Replies
14
Views
2K
  • Computing and Technology
Replies
18
Views
1K
  • Computing and Technology
Replies
21
Views
2K
  • Computing and Technology
Replies
18
Views
1K
  • Computing and Technology
Replies
22
Views
2K
  • Computing and Technology
Replies
2
Views
2K
  • Programming and Computer Science
Replies
5
Views
981
  • Computing and Technology
Replies
18
Views
3K
  • Computing and Technology
2
Replies
37
Views
5K
Back
Top