install order "by hand"

I have moved all FreeBSD (on partition-1) directories and files into a slice on FreeBSD partition-2, by hand . After doing a clean-up of partition-1 and newfs’ng those slices, my next step is to move each directory and file individually back to the slices in which they belong, but in called order, according to the kernel. I’m hoping for a suggestion for moving files by hand, and not for dumping or tars.

My question is, which comes first, the chicken or the egg? Which should I start to move back first? Such as root, bin, sbin, libexec, lib (for each slice) such as root, tmp, var, then user-land. How about directories like rescue which may never be used or not that often? I would think rescue should be at the bottom.

How about the boot directory that contains the kernel, should it be at the top or the bottom of the stack? When doing a call to the kernel does it start it process from top to bottom, or from bottom to top?
 
Are you saying you're copying operating system files onto a running system?
Yes, since 8.2! Why do you think it’s not possible or is this a loaded question?

Regardless of the method I used (lets just pretend I mv the files to DOS), I need at least a few FreeBSD technical facts pertaining to my original questions so I can get started. Thank you.
 
It should be possible. After all the installation simply untar()s files from normal archives. But it's a complete waste of time and resources IMO.

The order of copying most probably doesn't matter. These are all just files on a filesystem. Just make sure you preserve the user/group ownerships and modes if you don't want to break the system and its security.

Why are you doing this again?!
 
That might work but what you will break is hard links because cp(1) doesn't know about them and the copies of hardlinked files will take lot more disk space than on the original. Why can't you just use net/rsync for the copying? Or even dump(8)/restore(8)?
 
max21 said:
my next step is to move each directory and file individually back to the slices in which they belong, but in called order, according to the kernel.
What on earth for? Why this specific order?

Is this a throwback to ancient days when FAT16 made a mess and you needed to defrag often?
 
What on earth for? Why this specific order?

What on earth for .... As a working stiff all I can do is come up with ideas of what I want to do. Usually I am beat after 12 hours with 3-4 hours of traveling back and forth, just to get to work. Knowing a little about the call-order of code when writing programs, I hoped that someone else who knows system-order could share his knowledge. It might be time consuming, but what isn’t, and who could it possible hurt to try. Every little bit count to speed up a system and all of its programs no matter what.

In the pass I used tar and dump, and still do. Above all other than back-up, they is great for consolidating all disk-space to the bite, with no defrag ever needed, and the speed-up is great. That’s the way I use to do it. Tar creates the best order it knows how. If I want to change that order that is my choice because with a little modification it could be tremendous, but who knows. Nothing beats a failure but a try and I’m willing to try it.

Example; I had lots of short-cuts on the desktop and I notice how the new one I created weeks or months latter would be the last to pop-up at system start. It’s a delay that is not needed. This proved to me that the desktop directory was scattered. Eventually, after some planning, I made this directory the last to copy back to the system and now they all pop-up at the same time in a flash. So the fact remains that could apply to many other files and directories. FreeBSD has the perfect order when we first install it, but when we add port’s and packages, files get over written and other parts are scattered elsewhere. Now the system has to spend more time gathering these files at boot time. I hope this answer your questions. To consolidate files could only helps any system to speed-up. defrag is not enough even for Windows.
 
Considering your free time sounds rare, I suggest a more objective measure of the performance benefits before you engage is this optimization masturbation.
 
Considering the time I have, one would stay with the simplicity of Windows. A hand created order could never be perfect, but I plan to be very close in a short amount of time now that I know its bottom up. I saw a sample for FreeBSD in the past, but it’s difficult to keep up with all you find on the internet.

Although you can do all of the above by hand for each system call, system libraries usually do most of the work for you.
http://www.bottomupcs.com/system_calls.html
https://www.google.com/search?output=se ... yAT7t4KQAQ

No major operation needed.

See attachment ... the rest is history ... (if attach don't work I'll post the script)
 
Code:
#!/usr/local/bin/bash
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  Before DUMPING or "moving" - remove Flags
echo "STEP (A)"
echo "-"
echo "remove flags for DUMPING Partiton-1"
####
####  This is for Dumping and Cleaning the SLICES than back AGAIN!

# ..................................................................  518 usr-lib
# ..................................................................    1 schg
chflags noschg /m1/usr1/lib/librt.so.1		#  -r--r--r--

# ..................................................................  518 usr-lib32
# ..................................................................    5 schg
chflags noschg /m1/usr1/lib32/libc.so.7		#  -r--r--r--
chflags noschg /m1/usr1/lib32/libcrypt.so.5	#  -r--r--r--
chflags noschg /m1/usr1/lib32/librt.so.1	#  -r--r--r--
chflags noschg /m1/usr1/lib32/libthr.so.3	#  -r--r--r--
chflags noschg /m1/usr1/lib32			#  -r--r--r--

# ..................................................................  443 usr-bin
# ..................................................................   15 schg
chflags noschg /m1/usr1/bin/chfn		#  -r-sr-xr-x
chflags noschg /m1/usr1/bin/chpass		#  -r-sr-xr-x   *
chflags noschg /m1/usr1/bin/chsh		#  -r-sr-xr-x
chflags noschg /m1/usr1/bin/crontab		#  -r-sr-xr-x
chflags noschg /m1/usr1/bin/login		#  -r-sr-xr-x
chflags noschg /m1/usr1/bin/opieinfo		#  -r-sr-xr-x
chflags noschg /m1/usr1/bin/opiepasswd		#  -r-sr-xr-x

chflags noschg /m1/usr1/bin/passwd		#  -r-sr-xr-x
chflags noschg /m1/usr1/bin/rlogin		#  -r-sr-xr-x
chflags noschg /m1/usr1/bin/rsh			#  -r-sr-xr-x
chflags noschg /m1/usr1/bin/su			#  -r-sr-xr-x
chflags noschg /m1/usr1/bin/ypchfn		#  -r-sr-xr-x
chflags noschg /m1/usr1/bin/ypchpass		#  -r-sr-xr-x
chflags noschg /m1/usr1/bin/ypchsh		#  -r-sr-xr-x
chflags noschg /m1/usr1/bin/yppasswd		#  -r-sr-xr-x

# ..................................................................  44 root-bin
# ..................................................................   1 schg
chflags noschg /m1/root1/bin/rcp

# ..................................................................  46 root-lib
# ..................................................................   3 schg
chflags noschg /m1/root1/lib/libc.so.7		#  -r--r--r--
chflags noschg /m1/root1/lib/libcrypt.so.5	#  -r--r--r--
chflags noschg /m1/root1/lib/libthr.so.3	#  -r--r--r--

# ..................................................................   1 r-libexec
# ..................................................................   1 schg
chflags noschg /m1/root1/libexec/ld-elf.so.1	#  -r-xr-xr-x
chflags noschg /m1/root1/libexec/ld-elf32.so.1	#  -r-xr-xr-x  if-32

# .................................................................. 126 root-sbin
# ..................................................................   1 schg
chflags noschg /m1/root1/sbin/init		#  -r-xr-xr-x

# ..................................................................   1 var-empty
# ..................................................................   1 schg
chflags noschg /m1/var1/empty			#  dr-xr-xr-x

# ....................................................................
echo "DONE!!!"
echo "**************************************************"
echo "**************************************************"
















########################################## FreeBSD 8.2 FULL  /USR
# /usr/bin	443	15     add 2 for gnome	445    gcore - gcov
# /usr/lib	518	1
# /usr/lib32	545	4
# /usr/libexec	 59
# /usr/libdata	  3
# /usr/include	271
# /usr/sbin	270
##					    FreeBSD 8.2 FULL  /
# /bin		 44
# /lib		 46
# /libexec	  2
# /sbin		124
# /etc		101
########################################## done
 
@max21, why not replace the first line with #!/bin/sh? This way you don't rely on any third party software.
 
Last edited by a moderator:
I forgot to post the restore flag script. Anything less is no fun, but anything in-between is now an easy choice. This was based on 9.2 live-files unmovable on what I thought was a dead partition-1 that is now mounted. I’m kind of sure they are the same for 10.0 if not something new added ... I’ll be playing with this tomorrow. I keep plenty of backups.

Code:
#!/usr/local/bin/bash
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   Restore Flags
echo "STEP (F)"
echo "-"
echo "restore flags for Partition-1"
####
####  RESTORE FLAGS !

# ................................................................  518 usr-lib
# ................................................................    1 schg
chflags schg /m1/usr1/lib/librt.so.1		#  -r--r--r--

# ................................................................  518 usr-lib32
# ................................................................    5 schg
chflags schg /m1/usr1/lib32/libc.so.7		#  -r--r--r--
chflags schg /m1/usr1/lib32/libcrypt.so.5	#  -r--r--r--
chflags schg /m1/usr1/lib32/librt.so.1		#  -r--r--r--
chflags schg /m1/usr1/lib32/libthr.so.3		#  -r--r--r--
chflags schg /m1/usr1/lib32			#  -r--r--r--

# ................................................................  443 usr-bin
# ................................................................   15 schg
chflags schg /m1/usr1/bin/chfn			#  -r-sr-xr-x
chflags schg /m1/usr1/bin/chpass		#  -r-sr-xr-x   *
chflags schg /m1/usr1/bin/chsh			#  -r-sr-xr-x
chflags schg /m1/usr1/bin/crontab		#  -r-sr-xr-x
chflags schg /m1/usr1/bin/login			#  -r-sr-xr-x
chflags schg /m1/usr1/bin/opieinfo		#  -r-sr-xr-x
chflags schg /m1/usr1/bin/opiepasswd		#  -r-sr-xr-x

chflags schg /m1/usr1/bin/passwd		#  -r-sr-xr-x
chflags schg /m1/usr1/bin/rlogin		#  -r-sr-xr-x
chflags schg /m1/usr1/bin/rsh			#  -r-sr-xr-x
chflags schg /m1/usr1/bin/su			#  -r-sr-xr-x
chflags schg /m1/usr1/bin/ypchfn		#  -r-sr-xr-x
chflags schg /m1/usr1/bin/ypchpass		#  -r-sr-xr-x
chflags schg /m1/usr1/bin/ypchsh		#  -r-sr-xr-x
chflags schg /m1/usr1/bin/yppasswd		#  -r-sr-xr-x

# ................................................................  44 root-bin
# ................................................................   1 schg
chflags schg /m1/root1/bin/rcp

# ................................................................  46 root-lib
# ................................................................   3 schg
chflags schg /m1/root1/lib/libc.so.7		#  -r--r--r--
chflags schg /m1/root1/lib/libcrypt.so.5	#  -r--r--r--
chflags schg /m1/root1/lib/libthr.so.3		#  -r--r--r--

# ................................................................   1 r-libexec
# ................................................................   1 schg
chflags schg /m1/root1/libexec/ld-elf.so.1	#  -r-xr-xr-x
chflags schg /m1/root1/libexec/ld-elf32.so.1	#  -r-xr-xr-x  if-32

# ................................................................ 126 root-sbin
# ................................................................   1 schg
chflags schg /m1/root1/sbin/init		#  -r-xr-xr-x

# ................................................................   1 var-empty
# ................................................................   1 schg
chflags schg /m1/var1/empty			#  dr-xr-xr-x

# ................................................................
echo "ALL"
echo "DONE!!!"
echo "**************************************************"
echo "**************************************************"

Fix it for your use but be careful .. This is the way I wrote it because I knew no better. But it also made for good notes. I planned to some day learn how to script properly with the if command and stuff, but never got around to it yet.
 
Back
Top