Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help moving directories 1

Status
Not open for further replies.

JustKIDn

MIS
May 6, 2002
386
US
Hi All,

I've setup a SuSE linux pc for my kids. All is good.

I need to start adding educational programs but /dev/hda is going to be getting rather full.

It seems that most programs get installed in the /usr directory. So I want to add a new drive and move the /usr directory on to it.

So my questions are;

Is there anything I should watch out for?

Can I just install the drive and move the directory?

Do I need to add /usr to fstab?

What method of moving files should I use to maintain user and group status associated with each file/directory?

Did I miss anything?

Thanks!

tgus

____________________________
Families can be together forever...
 
Nonono.
We don't compare files with diff, but file-listings.
ls -laR lists filenames, owner, group, permissions, modify-date and size, so you will get a big big detailed list of the two directories and subdirs.

Those two LISTS are compared, and if there is no difference, there will be no difference by accident.

Try ls -laR in the /usr dir without diff (get a big can of coffee) to see what we mean.

If someone intentionally tries to trick you, he may modify a file without affecting it's size, and change the timestamp.
But as you pointed out, you only made a copy of the directory.

But I found another trouble.
ls -laR will print the time, and this will differ.
I didn't find a possibility, to activate 'user/group' without activating 'time'.

But we're hackers - aren't we?
Code:
ls -nR | sed 's/[12][09][890][0-9]-[0-9][0-9]-[0-9][0-9] [0-2][0-9]:[0-5][0-9]/DateTime/g' > ../usr.lst
ls: list directory
-n: number for user/group instead of name (implies date, perm., date)
-R: recursively visit subdirs

sed is the stream-editor.
sed 's/foo/bar/g' means 'substitute foo with bar globally' (not only the first occurence).

And
[12][09][890][0-9]-[0-9][0-9]-[0-9][0-9] [0-2][0-9]:[0-5][0-9]
is a regular expression for dates between 1980 and 2004 - well, that's not accurately true, but should work.

This is substituted by the token 'DateTime', to avoid comparing dates.

And the output of this command is sent to a file, not the screen.
> ../usr.lst

In a second step you repeat it for usr2:
...
> ../usr2.lst

and in a third step, you compare those lists with 'diff'
diff usr.lst usr2.lst.

I guess Eric will be glad to show you, how to put this in a single line :) (170 chars long)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top