# [SOLVED]hard drive crashing.  need to copy /tmp correctly

## chidychi

Hey, so like the topic says, one of my hard drives are crashing and the /tmp directory is on it.

I tried to make a new /tmp on a different hard drive by using the command: 

```
cp -a oldtmp newtmp 
```

 but, for some reason random files were skipped. 

I managed to track them down, and now i am in a permission nightmare.  Does anyone know of the proper command to use to clone this partition?

thanks 

chiLast edited by chidychi on Fri Feb 01, 2008 2:34 am; edited 1 time in total

----------

## frostschutz

What's in there? A tmp directory shouldn't contain any data that's important, at least not if it's in between reboots. So there is no need to backup / copy them.

----------

## Sadako

you shouldn't need to save anything from temp at all, I've never seen anything in /tmp taht was needed after a reboot, and a lot of people (including myself) completely wipe /tmp upon boot, the settings for which are in /etc/conf.d/bootmisc.

My point is you probably don't need to save/recover anything from this partition anyway.

----------

## chidychi

hey Hopeless and frostschutz

I figured that /tmp didn't matter either.  yet when i try to boot into kde with the new partition it complained of missing files.  Firefox also had an issue (fluxbox worked fine).

----------

## Sadako

You don't have /usr/tmp symlinked to /tmp, by any chance?

kde seems to cache stuff in /usr/tmp.

What files were kde and firefox complaining about?

----------

## chidychi

/usr/tmp is symlinked to /var/tmp

firefox was asking for orbit-"username" which is a directory; one that didn't copy the first time.

Kde right now is giving me permission errors.  can't write to /tmp.    I just figure that if i can't  log in with kde what other problems might arise?

Do you figure if i start with an empty /tmp it might fix itself?  or will i need to emerge -e world to fix permissions?

thanks

----------

## chidychi

BTW 

kde was complaining about missing something in tmp.  copying over /tmp/ksocket-"username" fixed it to the point of bad permissions now being the problem

----------

## Sadako

Ah, the so you were trying to change /tmp while the box was in use?

You should have just rebooted after setting the new /tmp, but if that's not an option then you should close down and restart the programs  which are complaining (which includes kde and preferably the X server and/or the diaplay manager itself).

You should also kill off all the various gnome and kde daemon processes before starting the applications again.

----------

## jstead1

you need to make sure to have the correct permissions on /tmp

should be writable by all users

if it isn't, kde may be trying to write something there, failing, then later crashing when it can't find what it couldn't write.

just a thought.

edit

just in case you have the wrong permissions, or just want to set it to the correct permissions

```
#chmod 1777 /tmp
```

the 1 is for the sticky bit

without the sticky bit, well, it just isn't sticky  :Wink: 

----------

## chidychi

oh nonono

 :Smile: 

what i did was try to do a exact copy from one drive to another 

like this 

i made a partition on a new drive to match the old one 

then copied over the files like so 

cp -a /tmp /newtmp   (after mounting of course)

then i went into fstab and changed the device to point to the new partition 

then i restarted the computer and it looked fine.  until i tried to log into kde.  

thanks

----------

## chidychi

hey jstead1

I intended to do so by using the -a flag through copy.  Does this not work in the way i intended?

thanks

----------

## chidychi

hey jstead1 

I just noticed your edit.

Best damn description of the sticky bit i have seen!

----------

## jstead1

it may not, especially if you created the new directory and then copied the contents to it.

you can fix it by changing the permissions (or just make sure it is right, chmod 1777 /tmp isn't going to hurt anything).

i don't know if you can reboot, it may be that some of the files in tmp are corrupted, (from the bad drive)

there is not anything in tmp that you need between reboots

----------

## jstead1

 *chidychi wrote:*   

> hey jstead1 
> 
> I just noticed your edit.
> 
> Best damn description of the sticky bit i have seen!

 

maybe i should write man pages.

----------

## chidychi

well i can definitely reboot.   

The drive housed two windows partitions a "media" partition my swap and the /tmp 

what happened is the windows partitions started acting wierd.   I tried to reformat, but windows died on trying to format the partitions.  Thats when i knew there was a problem.  

I downloaded the diagnostic tools from the manufacturer but came up with no errors.  Gentoo still runs fine on the drive,  but with windows not being able to format a partition..... better not take chances.

So i bought a drive made identical partitions and tried to reboot .   thats when these errors came about.

If i can clear out the /tmp then its worth trying.

I will delete the "new" /tmp and reboot and see if any errors persist.

cheers

----------

## chidychi

Thanks for the help guys.

I removed everything from /tmp and changed the permissions to 1777

this solved all problems.

I am still confused as to why i would have to change permissions anyway.

Where do the permissions for the root of the drive come from?   

/  and /tmp are two different drives.  Each time I change a physical hdd for /tmp  will i have to reset the permissions??

thanks 

chi

----------

## aronparsons

 *chidychi wrote:*   

> Thanks for the help guys.
> 
> I removed everything from /tmp and changed the permissions to 1777
> 
> this solved all problems.
> ...

 

/tmp exists on your root partition and has mode 1777.  However, when you mount something over /tmp, the permissions come from the new filesystem.  So mount the drive you want at /tmp and then set the mode to 1777.  It will stay the same every time you mount it (unless you're passing it options via /etc/fstab or with your mount command).

----------

