effects of initializing git repository on linux root directory 3:)
Asked Answered
F

3

8

I am running beaglebone black on ubuntu installed on sd card. i am learning to program the device in trial and error method by installing various packages (just like CERN guys study sub atomic particles by hitting them together in various angles and studying their trajectories). So can i initialize a git repository at root directory and ignore volatile directories like /sys and /proc? Or watching what system directories is sufficient to successfully time track entire OS? Are there any similar snapshoting tools? Other than git, what repository system is best to time track binary files?

--EDIT--

What is list of non-volatile and important(unlike /tmp) directories in /?

Fredericafrederich answered 16/7, 2013 at 9:27 Comment(3)
you can use git to track all your files and as you noticed you would want to ignore some directories pretty soon. HOWEVER i think the CERN guys are taking their approach as they really do not have any alternative. you have plenty of alternatives and might consider to read some documentation to tackle the problems from two sides (hands-on and theoretical).Bishop
@Bishop sometimes its the easiest way :)Fredericafrederich
Hmm, you could run git init on / without admin on windows...Bivouac
M
2

Instead of using git you could use a filesystem that support snapshots, like ZFS or BTRFS it will be more efficient and it's usage will be transparent to you.

Myrmecology answered 16/7, 2013 at 9:31 Comment(6)
Can i now change my filesystem from ext4 to zfs?Fredericafrederich
For what I know is not so simple to switch from an existing filesystem like ext4 to ZFS (or BTRFS) on a running system. A solution could be reinstall the system or using the new filesystem only on a new partition.Myrmecology
Using it can i take and restore snapshots as easy as i do in VirtualBox?Fredericafrederich
@neckTwi See some documentation here ZFS snapshotsMyrmecology
though i gave an upvote i can't accept coz i'm fan of git, its too simple. Can u please give tutorial links for BTRFS to start.Fredericafrederich
Regarding the original question, probably the most relevant feature of a git repo is tracking changes to individual files and directories (e.g. git log /usr/sbin/). As far as I can tell, ZFS and BTRFS snapshots can’t do that.Curtsey
F
2

Anyway, i dare initiated git repo on / 'coz its just an ARM ubuntu on beaglebone black installed on 8GB sd card and we get ARM ubuntu as sector to sector SD card image, so we can't go for ZFS or BTRFS. I can mount the sd card on any Linux machine and checkout branches.

cd /
sudo git init
sudo vi .gitignore
/dev/
/lost+found/
/media/
/mnt/
/opt/
/proc/
/run/
/srv/
/sys/
/tmp/
/var/log/

sudo git add -A
sudo du -sh .git
297M    .git
git config --global user.name 'Your Name'
git config --global user.email [email protected]
sudo git commit -m "initial update and network configured"
sudo du -sh .git
308M    .git

Please suggest folders or files i can ignore. I shall keep updating this answer with ignore list and problems i face.


18 July 2013 21:59:00 IST My first checkout left me with bitter experience. When i tried to checkout a previous commit it threw some lock failures. Made a mistake of not noting down output.

Then I removed SD card from beaglebone and mounted on my Ubuntu desktop. It gave 2 mount points for each partition /media/rootfs/ and /media/boot/. I remounted /media/boot/ on /media/rootfs/boot/uboot, so now the file-system exactly resembled to that live file-system booted up on BeagleBone.

$ sudo cd /media/rootfs
$ sudo git log
commit 8bf5b7031bc1aee6392272da4eae2b808b46912f
Author: gowtham <gowtham@beaglebone>
Date:   Thu Jul 18 12:04:05 2013 +0000

    remotedevicecontroller with camcapture-compression option

commit 774765de36a0c3cc7280a29275c37928de982f6e
Author: gowtham <gowtham@beaglebone>
Date:   Thu Jul 18 06:19:48 2013 +0000

    before installing remotedevicecontroller with camcapture-compression

commit 19d5f3f66f29cbe925b8743c7248770d1f1d6ba4
Author: gowtham <gowtham@beaglebone>
Date:   Wed Jul 17 13:34:33 2013 +0000

    ffmpeg installed by remotedevicecontroller

commit 691c20afd7b166103dabc2561c72eb94c172e726
Author: gowtham <gowtham@beaglebone>
Date:   Wed Jul 17 14:44:17 2013 +0000

    initial update and network configured
$ sudo git stash
[sudo] password for gowtham: 
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
You do not have the initial commit yet

But .git/ is present in /media/rootfs/. comment below, the mistakes I've done.

Fredericafrederich answered 16/7, 2013 at 18:3 Comment(0)
Q
0

another way to do in the / folder is a whitelist approach:

echo '*' > .gitignore  #ignore everything in root
git add -f .gitignore
git add -f /folders_you_wish_to_include   #using -f to add the folders you want to track
Quark answered 7/5, 2020 at 2:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.