Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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).
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 ...
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.
Well, it looks like I have a lot of admin. work ahead...
Shrink the /home filesystem and then reduce the size of the logical volume in order to make more space for /var
Create a new /var logical volume, because /var was inside the /
Copy /var inside the new logical volume
Copy needed files from /tmp to /var (this is because sbopkg uses /tmp for working and saving finished packages, and I'm interested in keeping these) (I think)
Modify /etc/sbopkg/sbopkg.conf so now it points to /var
Modify fstab so the new logical volume will be /var and mount /tmp as a tmpfs
Restart and pray to "Bob" that everything will work well
If so, clean rubbish left in /tmp and /var, which will increase the size of / a lot
Resize the / filesystem and reduce the logical volume, in order to use the left space for something better
Pheeew... please, could you check that I didn't forget anything (well, besides marking the thread as solved, afterwards)
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.
You won't be able to do that from the running system, because /tmp and /var will show the content of the mounted filesystem, and you can't unmount them with the system running.
Do that from a live distro.
EDIT: Damn, I realized a second too late that syg00 already told you that.
You won't be able to do that from the running system, because /tmp and /var will show the content of the mounted filesystem, and you can't unmount them with the system running.
By making use of a bind mount, you indeed can clear the old /tmp and /var while the new filesystems are mounted there.
Code:
mkdir /mnt/tmproot
mount --bind / /mnt/tmproot
Now you can clean out /mnt/tmproot/tmp amd /mnt/tmproot/var however you like
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.