boot to install disk:
mkdir /foo
mount root partition to foo (in my case R0 array)
mount /dev/md1 /foo
mount dev, proc, and sys via bind mountpoints. First define temporary variable:
a='dev proc sys'
and then apply the following for loop:
for i in $a; do mount --bind /$i /foo/$i; done
I almost forgot to add this; you need to chroot into foo:
chroot /foo
Since we want to update all directories with the exception of dev, proc, and sys, we can make another variable containing all root sub directories except the ones we've mounted via --bind, and update the timestamps on the results.
I wrote the following script to accomplish this task:
#!/bin/bash
# update timestamp.sh
b=$(ls / | egrep -v "dev|proc|sys")
for i in $b; do
cd /$i && find . -exec touch -h {} \;; \
done
exit 0
#EOF
Notes:
It is important to update the hwclock of the system prior to running this script, otherwise it will keep whatever time was on the BIOS. If your system can access the rtc device, you can update via hwclock:
hwclock --set --date "11/23/2014 13:50:30"
at which point you can update the system time via:
hwclock -s
I've tried this script once before w/o the -h switch, but it screwed up my system. It updated all the timestamps on files great, with the exception of the important ones--symlinks. Think vmlinuz.. right.
With the -h switch however it ran great and everything was good to go.
(I originally shared this in late august on my fb page, but realized it would be better served here since I only have like 4 friend in RL that understand Linux.)
Links:
http://www.linuxquestions.org/questions/linux-general-1/update-time-stamp-during-mount-4175520145/
Notes:
- November 23, 2014: I realized that the script wouldn't run as it was written. The for loop needs to be changed from:
for i $b; do
cd /$i \
find . -exec
to:
for i in $b; do
cd /$i && find . -exec touch -h {} \;; \
the 2nd iteration forces the find/touch command to be executed upon completion of the initial change directory command.
mount /dev/md1 /foo
mount dev, proc, and sys via bind mountpoints. First define temporary variable:
a='dev proc sys'
and then apply the following for loop:
for i in $a; do mount --bind /$i /foo/$i; done
I almost forgot to add this; you need to chroot into foo:
chroot /foo
Since we want to update all directories with the exception of dev, proc, and sys, we can make another variable containing all root sub directories except the ones we've mounted via --bind, and update the timestamps on the results.
I wrote the following script to accomplish this task:
#!/bin/bash
# update timestamp.sh
b=$(ls / | egrep -v "dev|proc|sys")
for i in $b; do
cd /$i && find . -exec touch -h {} \;; \
done
exit 0
#EOF
Notes:
It is important to update the hwclock of the system prior to running this script, otherwise it will keep whatever time was on the BIOS. If your system can access the rtc device, you can update via hwclock:
hwclock --set --date "11/23/2014 13:50:30"
at which point you can update the system time via:
hwclock -s
I've tried this script once before w/o the -h switch, but it screwed up my system. It updated all the timestamps on files great, with the exception of the important ones--symlinks. Think vmlinuz.. right.
With the -h switch however it ran great and everything was good to go.
(I originally shared this in late august on my fb page, but realized it would be better served here since I only have like 4 friend in RL that understand Linux.)
Links:
http://www.linuxquestions.org/questions/linux-general-1/update-time-stamp-during-mount-4175520145/
Notes:
- November 23, 2014: I realized that the script wouldn't run as it was written. The for loop needs to be changed from:
for i $b; do
cd /$i \
find . -exec
to:
for i in $b; do
cd /$i && find . -exec touch -h {} \;; \
the 2nd iteration forces the find/touch command to be executed upon completion of the initial change directory command.
No comments:
Post a Comment