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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Killed /var...now what?

Status
Not open for further replies.

lazyrunner50

Programmer
Jul 30, 2004
63
US
Ok, so I am trying to mount /var on a new hard drive I just set up. I had everything working fine (on my primary hard drive), and then I added a new hard drive. I set it up (fdisk, mkfs), and then I tried to set up /var on /dev/hdb2 (the second partition on my new drive). I did the following:
Code:
e2label /dev/hdb2 /var
mount -t ext3 /dev/hdb2 /var
I then edited the /etc/fstab
Code:
/dev/hdb2  /var   ext3  defaults 1 2
Upon rebooting, I found a small problem... /var was empty! Well, I realized that the data was still there on /dev/hda1, so I booted into recovery mode, removed the fstab entry to point /var to /dev/hdb2, and it worked fine. So, I figured if I mounted /dev/hdb2 on say /mnt/someDir, copied all the contents of /var to that directory, then changed back the fstab to point /var to /dev/hdb2, it would work. Yeah, doesn't work so well...I got all sorts of problems saying it couldn't write to /var/log/sa/sa29, and can't touch the file /var/lock/subsys/network, and so on... Anyway, how do I go about changing this, so that /var can exist on my second hard drive?
 
copied all the contents of /var to that directory

How did you do the copy?
Looks like owner and permissions are wrong now.
Did you use -p option of cp command?
 
They probably still have the same label. IN fact, why use e2label if you then point to the phisical device directly on fstab?

Especially with RH systems, I found that their way to use labels as well as phisical devices can lead to serious mistakes; it is in fact one of the typical things you get confronted with during the RHCE exam.

I like the good old way and use only phisical devices.

COming to your issue with copied content of the two directories, hoinz is correct, it really looks like your permissions are f***ed.
I would do a tar with -cpf attributes and move it across

Cheers

QatQat

If I could have sex each time I reboot my server, I would definitely prefer Windoz over Linux!
 
Your book uses references to RHEL 3 which is a little outdated on a few things. You can get manuals for RHEL 5 here: The Deployment Guide seems to cover what you are working on right now. You can view them online in html form or download them in pdf form. You will also see references to other resources there.
 
Cool ok thanks everyone. I'll try the suggestions.

QatQat - Sorry, but how do it do it the "good old way"?

Hoinz - I just did cp -r /var /mnt/someDir
 
Well, unfortunately, that still didn't work. I did the following in recovery mode:
Code:
umount /var <-- Currently  mounted on /dev/hdb2
mount /dev/hdb2 /mnt/someDir
cd /var
tar -cpf /root/myTar.tar *
cp /root/myTar.tar /mnt/someDir
cd /mnt/someDir
tar -xpf myTar.tar
rm myTar.tar
Then I rebooted into standard mode. It gave the following error:
Code:
starting sysstat: calling the system activity data collector (sadc) cannot open /var/log/sa/sa30: Permission denied
it also failed to start several other processes such as:
auditd
system logger
kernel logger
NFS statd
....
and so on

However, it still came up. After it was up and running, I checked and /var/log/sa/sa30 has 644 permissions, so I'm not sure why it is complaining...

Rhythm, thanks for the link. The manual uses the gui to accomplish a similar task, but I'd rather do it from the command line. The gui tends to hide too many of the details :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top