Building LFS/BLFS on USB.

Michael Shell list1 at
Sat Apr 7 13:48:50 PDT 2007

On Sat, 7 Apr 2007 11:25:28 +0200
"Tijnema !" <tijnema at> wrote:
> Well, i have /dev/hda1, /dev/hdb1, /dev/hdb2 mounted as filesystems
> (/data, /, /boot), /dev/hdb3 as swap and /dev/sda1 as /mnt/usb. So
> will i be able to copy the whole /dev dir, or would i need to skip
> /dev/hd{a1,b1,b2,b3} and /dev/sda1? and how to get those if i need to
> skip them??

It doesn't matter whether the devices are in use or not. cp -a will
just copy them as /dev files and will not try to open or access them.
Ain't Unix great? Try that on Windows. Every version of Windows I ever
used (with the possible exception of 3.1) won't let me backup a live
system without special software - it errors with something like
"system file in use". I read somewhere once that Gates et al.
intentionally did this so that people cannot move the OS around. So,
these days I just mount the Windows partition to /mnt/mwsin and use
Linux to back it up. Of course, the new security in XP and later can
cause other hiccups, which is one reason why I've moved even further
away from Windows.

> Interesting thought:) But i should prefer the syntax:
> cp -a /* !mnt /mnt/backup
> This could be written quite easy in a Shell script, but this would
> break the cp command, because it won't be able to copy files starting
> with ! anymore...

Well, what about going the way of a GNU-ism:

cp -a --not-file *.txt / /mnt/backup

(don't copy files that end in .txt)

cp -a --not-dir /mnt / /mnt/backup

don't do the /mnt directory.

I'd also want a:

cp -a --no-descend /mnt/* /mnt/backup

which would copy the contents of /mnt, but would not go down into
the subdirectories of it, but would descend in every other
directory. (i.e., selectively turn off -R)

Thus, the /mnt/backup directory would be copied to
/mnt/backup/mnt/backup, but not /mnt/backup/*

I also have often wanted cp to be able to do something

cp *.txt *.tex

to make copies of all .txt files with the same name, but ending with
.tex. That is, I'd like cp to have some or all of the functionality
of the "to" option of rename. Maybe an added --to option
would be the way to go here. There is a concept here that needs
more thought. Typically, the * match independently. That is,
*.txt is all files that end in .txt and *.tex is all files
that end in .tex However, it seems that sometimes I want a new
character that means the part that was matched by the last "*". 
expression. Maybe something like:

cp *.txt **.tex

where "**" means whatever the "previous" "*" matched.

Another Unix "feature" that always bugged me is that the -d option

ls -d *

is needed to prevent ls from descending into subdirectories. The
default behavior of ls, IMHO, is just sick. (Who the heck is
responsible for that one?) I always tend to have to use:

ls -lad *

to get what I want. Some people even implement a "dir" shell
script to do this. However, its against my Unix religion to
type "dir". ;) 

Finally, I hate the whole idea of hidden .files. How many times
has somebody been stumped when looking for


and why the heck should that particular one be hidden anyway?

I would have ditched the whole hidden file thing, or implemented it
as a mode option setable vi chmod. I don't like file properties
being coded as part of the file name, with the exception of 
.extensions, which most commands do not take into consideration.
Those that do sometimes trip me up. (e.g., mplex requiring a
.lpcm extension ticked me off on time.) As far as ~/.* files go,
for goodness sake, they should all be openly visible in ~/etc just
like with /etc

That's pretty much my Unix rant. All in all, relatively speaking,
there isn't that much to complain about. ;)


More information about the blfs-support mailing list