Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 01-21-2013, 12:01 PM   #1
LQ Newbie
Registered: Jan 2013
Posts: 14

Rep: Reputation: Disabled
Question How to easily copy changes in one linux filesystem to another ?


I'm using linux (debian based distro) in embedded applications but my question is actually quite generic.

So I start out with some basic linux installation, install new programs, add my own scripts and customize various files according to the application. We then ship the first prototype devices and following customer feedback need to do some changes.

My problem is how can I easily send changes to the customer - without having to send him a full 4GB image for every update ?

The required updates might require changes to existing files, as well as addition or deletion of files in several different directories.

The best way I have found so far is to load the updated image on a prototype device, copy the entire installation to a local folder on my workstation using scp. Then I delete all the major directories in which I know there were no changes to reduce the total size as much as possible. I then send the resulting directory to the customer together with a batch file that runs scp to copy these files over to the target device.

This works fine but there are a number of problems:
- the size of the files to transfer is still larger than really required.
- manual deletion of the unchanged folders is a tedious process and mistakes are easy.
- deletion of files of the target installation is not prossible - only addition and updates are possible.

Is there any way to sort of create a "diff" of two filesystems and "automatically" generate some kind of patch that makes the target filesystem identical to the source ?

Old 01-21-2013, 06:05 PM   #2
Senior Member
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 651Reputation: 651Reputation: 651Reputation: 651Reputation: 651Reputation: 651
How does the customer usually update the device and do they want to change their process ? .. maybe they could set up a local copy of the filesystem and you/they could rsync from yours to theirs over the Internet?
Old 01-22-2013, 01:49 PM   #3
LQ Newbie
Registered: Jan 2013
Posts: 14

Original Poster
Rep: Reputation: Disabled
rsync is a good idea but I would prefer to have some kind of update file that can be used offline and stored for later use.

Old 01-22-2013, 02:51 PM   #4
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,569

Rep: Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129
What if you use rsync -avn --delete and dump the output to a log file. The -n tells rsync to do a dry run, meaning nothing is modified on the source or destination. Instead rsync prints out what it WOULD have done. You can then write a simple script to turn this log into a patch and gather all of the files it needs.

For example:
$ ls -l original/*
-rw-rw-r-- 1 user user   12 Jan 22 13:38 original/file1
-rw-rw-r-- 1 user user    6 Jan 22 13:38 original/file2
-rw-rw-r-- 1 user user    8 Jan 22 13:38 original/file3

total 0
-rw-rw-r-- 1 user user 0 Jan 22 13:37 file4
-rw-rw-r-- 1 user user 0 Jan 22 13:37 file5

total 0
-rw-rw-r-- 1 user user 0 Jan 22 13:38 file6

total 0
-rw-rw-r-- 1 user user 0 Jan 22 13:38 file7
-rw-rw-r-- 1 user user 0 Jan 22 13:38 file8

total 0
$ ls -l modded/*
-rw-rw-r-- 1 user user    6 Jan 22 13:39 modded/file1
-rw-rw-r-- 1 user user   19 Jan 22 13:39 modded/file2
-rw-rw-r-- 1 user user    8 Jan 22 13:38 modded/file3

total 0
-rw-rw-r-- 1 user user 0 Jan 22 13:37 file5

total 0
-rw-rw-r-- 1 user user 0 Jan 22 13:38 file6

total 0
-rw-rw-r-- 1 user user 0 Jan 22 13:39 newfile
You can see that in the "modded" directory, I modified file1 and file2, removed dir1/file4, removed dir3 entirely, and added dir4/newfile
$ rsync -avn --delete modded/ original/
sending incremental file list
deleting dir3/file8
deleting dir3/file7
deleting dir3/
deleting dir1/file4

sent 231 bytes  received 33 bytes  528.00 bytes/sec
total size is 33  speedup is 0.12 (DRY RUN)
The output is pretty much a list of instructions for your script.

Last edited by suicidaleggroll; 01-22-2013 at 02:54 PM.
1 members found this post helpful.
Old 01-22-2013, 04:34 PM   #5
LQ Newbie
Registered: Jan 2013
Posts: 14

Original Poster
Rep: Reputation: Disabled
That's one clever idea! might be just what I need actually.

Most probably I will need to send one such update this week so I will try this out and let you know how it goes.

Thanks for the detailed reply!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Copy root filesystem from RAM to flash? littlebigman Linux - Newbie 9 06-14-2011 04:55 AM
Need to know how to copy a root file from non corrupted filesystem to another amsweitzer General 4 04-20-2011 10:42 PM
How do I copy /dev/* from filesystem to filesystem Ulysses_ Linux - Desktop 12 03-09-2011 09:53 PM
need linux script to copy large deep directory structure to other filesystem vanvoj Programming 4 11-04-2009 03:19 AM
where to find the source code for a small easily loadable filesystem ramya272 Linux - Newbie 0 02-26-2004 10:16 AM > Forums > Linux Forums > Linux - General

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration