LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-25-2019, 05:49 AM   #1
Sharvin26
LQ Newbie
 
Registered: Feb 2019
Posts: 21

Rep: Reputation: Disabled
Storing System configuration in a Persistent Partition ( Debian OS )


I have 4 Partitions on a Disk.

mmcblk0p1 has a boot configuration.
mmcblk0p2 has a Debian Os. ( Let's name OS1 )
mmcblk0p3 has another Debian Os. ( Let's name OS2 )
mmcblk0p4 is persistent storage.

I have some configurations under /etc and /var which is static for both the Operating system i.e these configurations will be the same across both the OS1 and OS2.

I am using Persistent storage for storing such configurations. How can I add these directories to this Persistent storage So that it can be accessed from both OS1 and OS2?
 
Old 02-25-2019, 02:02 PM   #2
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Menu item 10.3 of this article should help you achieve your goals.
 
Old 02-25-2019, 03:25 PM   #3
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
When I had two Debians installed on my drive, I created a debian folder in my data drive, in that folder I created a "apt" folder and a "list" folder. In the apt folder I created the "archives" folder and in that the "partial" folder and a lock file to mimic everything in the /var/cache/apt directory of the root partitions. In the lists folder I created a lock file and copied all lists files from /var/lib/apt/lists to the data/debian/lists folder. My data drive is mounted through /etc/fstab to my home directory in each Debian, so I then deleted the /var/cache/apt and /var/lib/apt/lists directories in each Debian root partitions and soft linked those new directories in the data drive back to the root partitions in each Debian with commands:
Code:
ln -s /home/jo/Data/debian/apt /var/cache/apt
ln -s /home/jo/Data/debian/lists /var/lib/apt/lists
Then I ran command: apt-cache stats to create the pkgcache.bin and srcpkgcache.bin files in the new /home/jo/Data/debian/apt directory.

Now both Debians share the same cache and lists directories, when I update and upgrade one Debian, all packages are in the cache and lists are updated, then I just do the upgrade in the other Debian which typically don't need to download anything because all packages are already in the cache and the lists are already updated.

I did this to reduce the amounts of writes to the SSD drive where the Debians are installed, now all the constant writing involved with updating Debian testing (which has lots of updates constantly) happens on the HDD data drive, and packages only need be downloaded once.

Reason I mention this, is that it's better to soft link shared directories rather than use persistence. With persistence, files don't get deleted, they are marked as deleted and eventually the persistence becomes full. Many folks who have maxed out their persistence on USB keys have reported the key was non-functional and beyond repair when this happens.
 
Old 02-26-2019, 09:11 AM   #4
Sharvin26
LQ Newbie
 
Registered: Feb 2019
Posts: 21

Original Poster
Rep: Reputation: Disabled
Thank you for the response
Quote:
Originally Posted by Brains View Post
When I had two Debians installed on my drive, I created a debian folder in my data drive, in that folder I created a "apt" folder and a "list" folder. In the apt folder I created the "archives" folder and in that the "partial" folder and a lock file to mimic everything in the /var/cache/apt directory of the root partitions. In the lists folder I created a lock file and copied all lists files from /var/lib/apt/lists to the data/debian/lists folder. My data drive is mounted through /etc/fstab to my home directory in each Debian, so I then deleted the /var/cache/apt and /var/lib/apt/lists directories in each Debian root partitions and soft linked those new directories in the data drive back to the root partitions in each Debian with commands:
Code:
ln -s /home/jo/Data/debian/apt /var/cache/apt
ln -s /home/jo/Data/debian/lists /var/lib/apt/lists
Then I ran command: apt-cache stats to create the pkgcache.bin and srcpkgcache.bin files in the new /home/jo/Data/debian/apt directory.

Now both Debians share the same cache and lists directories, when I update and upgrade one Debian, all packages are in the cache and lists are updated, then I just do the upgrade in the other Debian which typically don't need to download anything because all packages are already in the cache and the lists are already updated.

I did this to reduce the amounts of writes to the SSD drive where the Debians are installed, now all the constant writing involved with updating Debian testing (which has lots of updates constantly) happens on the HDD data drive, and packages only need be downloaded once.

Reason I mention this, is that it's better to soft link shared directories rather than use persistence. With persistence, files don't get deleted, they are marked as deleted and eventually the persistence becomes full. Many folks who have maxed out their persistence on USB keys have reported the key was non-functional and beyond repair when this happens.
I was trying this method on /etc/hostname. ( hostname is a file )

I have mounted the persistent partition on /home/debian/Data/debian.

I have created a directory named etc on /home/debian/Data/debian/ and added the hostname file on that /home/debian/Data/debian/etc directory.

Then I tried to create the link using this command:
ln -s -T /home/debian/Data/debian/etc /etc/hostname

I am using -T as it treats LINK_NAME as a normal file always

But it is creating a directory in /etc/ named as hostname while it should make a file named hostname.
 
Old 02-26-2019, 03:24 PM   #5
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Quote:
Originally Posted by Sharvin26 View Post
ln -s -T /home/debian/Data/debian/etc /etc/hostname

I am using -T as it treats LINK_NAME as a normal file always

But it is creating a directory in /etc/ named as hostname while it should make a file named hostname.
Your link command linked the etc directory (in red), not the file within called hostname. You need to link the file inside to create a file link in /etc:
Code:
ln -s -T /home/debian/Data/debian/etc/hostname /etc/hostname
 
Old 02-27-2019, 06:51 AM   #6
Sharvin26
LQ Newbie
 
Registered: Feb 2019
Posts: 21

Original Poster
Rep: Reputation: Disabled
Thank you for the Response I have a issue If you can have a look at the issue it would be great.
 
  


Reply

Tags
configuration, debian, linux, partition



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
Where is 15.10 storing gnome-terminal configuration? Cyberman Ubuntu 7 03-21-2016 08:41 PM
Persistent persistent Persistent Going Nuts Here Fcukinyahoo Linux - Newbie 6 11-17-2011 09:56 PM
Will Deleting 70-persistent-cd.rules and 70-persistent-net.rules Work As a "Live USB" Konphine Linux - General 1 10-09-2011 03:55 PM
Storing wireless configuration in Slackware v3gard Linux - Newbie 5 09-29-2007 08:43 AM
persistent static routes, not so persistent Hewson Linux - Networking 4 04-27-2007 05:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:48 PM.

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