Find the answer to your Linux question:
Results 1 to 5 of 5
hi, sorry if this question has already been answered, could not find it. i'm attempting to redirect the /tmp directory to a partition outside my savefile. using Code: mv /tmp ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2011
    Posts
    10

    How To Redirect /tmp Directory


    hi, sorry if this question has already been answered, could not find it.

    i'm attempting to redirect the /tmp directory to a partition outside my savefile.

    using
    Code:
    mv /tmp /mnt/new/location/tmp
    
    ln -s /mnt/new/location/tmp /tmp
    i tried this after exiting to a command prompt, but still getting "file in use". Any suggestions?

    thanks

    -----------------
    update:
    /root/Startup/README.txt says:
    to execute something at bootup and prior to X desktop loading, edit /etc/rc.d/rc.local

    so, i put the commands into rc.local. I believe it did not work

    suggestions welcomed!


    ---------
    Saluki puppy Linux on Asus pc
    Last edited by johnywhy; 07-02-2012 at 05:31 AM.

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,317
    there has to be a /tmp directory, you can't move it (or if you can, you shouldn't). you can copy it, though (if you really care about what is in there), and set the new mount point in /etc/fstab. then reboot. but watch out - the /tmp dir is needed early on in the boot process, so you have to make sure the partition you request for /tmp can get mounted by the system during init.

    but maybe what you really want is a tmpfs filesystem for /tmp? that way, nothing gets written to disk, when /tmp is used - it goes to memory instead. faster, and more secure. a lot of newer distros are doing this by default, nowadays.

  3. #3
    Just Joined!
    Join Date
    Aug 2011
    Posts
    10
    would this be correct?

    Code:
    /dev/sda1 /tmp ntfs defaults 0 0
    will this create a tmp directory in sda1?

    Quote Originally Posted by atreyu View Post
    the /tmp dir is needed early on in the boot process, so you have to make sure the partition you request for /tmp can get mounted by the system during init.
    how can I test for that? It's all on the same physical disk. Puppy Linux is configured to auto-mount all partitions, but I don't know how early they get mounted.

    Quote Originally Posted by atreyu View Post
    maybe what you really want is a tmpfs filesystem for /tmp? that way, nothing gets written to disk, when /tmp is used - it goes to memory instead. faster, and more secure.
    Sounds cool! But limited by available ram, correct?
    Last edited by johnywhy; 07-02-2012 at 07:26 AM.

  4. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,317
    Quote Originally Posted by johnywhy View Post
    would this be correct?

    Code:
    /dev/sda1 /tmp ntfs defaults 0 0
    will this create a tmp directory in sda1?
    well, the format of that line is technically correct, for the fstab file, but I don't think that is what you really want. Surely your /dev/sda1 is not an otherwise empty partition, right? and if it is your windows partition (on a dual-boot system, e.g.), then you SURELY do not want to use that as your /tmp filesystem. are you trying to make your /tmp dir accessible to both OSs (if dual-boot)?

    putting it another way, the line you have in /etc/fstab will attempt to mount the /dev/sda1 partition to the mount point /tmp using the ntfs filesystem. it won't "create" any directories itself, but during the course of the OS doing its thing, various processes will attempt to use the /tmp directory, and will likely complain/barf if the filesystem is NTFS.

    how can I test for that? It's all on the same physical disk. Puppy Linux is configured to auto-mount all partitions, but I don't know how early they get mounted.
    the problem surfaced for me when certain filesystems were mounted, but modules upon which they relied were not yet inserted by the Linux init process. in my case it was a USB drive (the filesystem drivers were loaded but the USB storage drivers were not).

    anyway, the best way to test is to just try it, as long as it is not a production machine (and as long as you don't care about hosing your Windows OS if sda1 is really Windows). after you make the change to /etc/fstab, you can boot into runlevel 1 and run mount to see if the /tmp filesystem loaded and if everything is happy. but again, i would not be surprised if you encounter errors if using NTFS - if not at first, then later on (when you least expect it)...

    Sounds cool! But limited by available ram, correct?
    yes. but RAM is cheap! and the nice thing about tmpfs is that it will dynamically resize itself, if it is not big enough, provided that there is enough RAM to allocate!

  5. #5
    Just Joined!
    Join Date
    Mar 2012
    Posts
    15
    You also could just mount the other partition with
    Code:
    mount /dev/sda2 /tmp
    where /dev/sda2 is the new partition

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •