How do I clone /tmp into a different filesystem?
Hello:
I have my / and /tmp using the same filesystem, into a logical volume (which itself is inside an encrypted container). I'd like to separate /tmp into a different logical volume. I want to keep it's size more controlled, and add some security options in /etc/fstab for mounting it. I know how to resize my logical volumes, its filesystems, create new logical volumes, and I have some idea about /etc/fstab. But... I don't know exactly how to "clone" the existing /tmp into the new logical volume. I mean, there are files inside my /tmp which I know for sure why they are there (like packages built by slackpkg), but there are others whose function is unknown to me; and I'm afraid I'll break something if I just copy them clumsyly and then access node times (or something else I don't know of) will be different on next reboot. BTW, I'm going to do this job in my HD from a "rescue" environment; Slackware's installation CD. OOT?: Most of these "unknown files" are named like: "virtuoso_n17983.ini" or "YvAiHe_H.part" (I guess these are from kde and a failed Firefox download, respectively). Well, what could the magical command be? :confused: |
isn't the whole point of /tmp that it's temporary?
in other words, do your fstab stuff, don't copy anything, because it'll be gone anyway once you reboot. https://en.wikipedia.org/wiki/Tmpfs |
Wrong.
IF /tmp were mounted as a tmpfs, it would disappear at re-boot. The OP states it is a real filesystem. But I agree with the sentiment - anything left in /tmp shouldn't be missed. And if it is, it will still be (unseen) under the root once it is mounted elsewhere. Personally I'd not copy anything over - and put a regime in place to clear it regularly. Or better, use a tmpfs ... :p |
Some help needed, still
Understood, mounting /tmp as a tmpfs would be faster and no files would be created in the HD. Still...
I have yet tmpfs (should be half of my memory, if I understand man mount well) mounted as shared memory in /dev/shm; my fstab: Code:
. Thanks for the help. |
You can mount as many tmpfs as you want (well, not really, but the limits are beyond reasonable use). Just use the default sizes, tmpfs only takes RAM that it actually uses.
|
Further to that, for a tmpfs, the "size" you see in df (for example) is the maximum size it can grow to (in RAM) - half of your RAM size by default. This is not like a normal filesystem where the size actually is the size of the formatted filesystem itself.
The system will manage it - see here for all the gory details. |
Could you check my list?
Well, it looks like I have a lot of admin. work ahead...
Thanks to all of you for your help. |
I would have thought the days of messing wtih filesystems to scrimp back disk space were long gone.
Personally I'd leave /var under the root, and just adjust the root filesystem in need - maybe not required as you'll get the current /tmp allocation back as you say. Note that 8 will have to be done (safest) from a liveCD - other than that looks ok. Hardly the end of the world if it fails, it's all easily recoverable from a liveCD. |
Quote:
Do that from a live distro. EDIT: Damn, I realized a second too late that syg00 already told you that. |
Quote:
Code:
mkdir /mnt/tmproot Code:
find /mnt/tmproot/tmp /mnt/tmproot/var -mindepth 1 -delete Code:
umount /mnt/tmproot |
Nice! I didn't think of that.
|
All times are GMT -5. The time now is 03:01 PM. |