a strategy to manage hd & memory space ...

You have a problem with Salix? Post here and we'll do what we can to help.
User avatar
jsfarinet
Posts: 305
Joined: 23. Nov 2014, 07:32

a strategy to manage hd & memory space ...

Post by jsfarinet »

Reflecting backward and forward i came to this conclusion - which seems to respect my needs best:

I want to have the following partitions:
/
/usr
/home
swap

And: set /tmp to a temporary ramdisk (so i won't have to care about its contents after shutting down the computer). Eventually, i'd even like to use zram but i do not find it for slackware ...

Actually, i've / and /home set up properly (as xfs), swap is set and also active but for some reason it seem to not work (?).

To get to my setup above i've several questions re what (and how) to do.

a) given i build a /usr partition (using gparted, formatting as xfs and marking it for usr) will i have to copy the entire directory "usr" to the new partition? In this way:

step 1 'sudo mount /dev/sda5 somedir'
step 2 'sudo cp -a /usr somedir'
step 3 'sudo rm -rf /usr'

Then, the system will automatically recognize the usr partition as /usr ? Or is there something to do in lilo as well?

b) What can i check about the swap additionally to make sure, it works? Gparted says it's active, swapon as well. But when i hibernate the system it does not come up. Is there a setting in lilo, i miss, eventually (i vaguely remember in grub there was something (??) ... )?

c) I totally forgot about tmpfs: Is it correct it's only an fstab setting thing?

Thanks a lot in advance for your patience!
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: a strategy to manage hd & memory space ...

Post by mimosa »

a) I would omit step 3 till you have successfully rebooted and it works! Step 2: you will end up with directory /usr at the top of the fs in sda5, but you don't want that because youa re going to mount the whole partition as /usr, so:

Code: Select all

cp -r /usr/* somedir
should be fine in this case, but I vaguely rememebr that cp can sometimes miss things (such as hidden files, which shouldn't be an issue here). As a general principle, it is probably best to use rsync. I just mention this as something to bear in mind and possibly investigate. Also, never delete anything you are backing up or moving till 100% sure all went to plan, see above.

Then you need to add a line in fstab to mount /usr on the partition.

Here is a starting-point for mounting /tmp to RAM. As you will see there are conflicting opinions. Bear in mind your aims - for instance, if you want to make sure everything in /tmp gets wiped on reboot for security reasons, note the comment on swap and ramfs.

http://unix.stackexchange.com/questions ... tmp-to-ram

Your swap probably works fine, but just isn't ever being used because RAM is enough. Swap is mostly not needed these days on normal hardware.

EDIT But if you remove /usr subsequently, you might end up also removing the copied files. To be sure, one way would be to use a Live, mount / from there and remove the directory /usr. There is probably a sound way to do this from within your system (get at the dir on the local partition even though it has been mounted on a different partition) but I don't know it, perhaps someone else does?

Perhaps like this, but the scope for user error is enough to make me prefer the long way round:

http://askubuntu.com/questions/669/is-i ... n-the-path
User avatar
gapan
Salix Wizard
Posts: 6361
Joined: 6. Jun 2009, 17:40

Re: a strategy to manage hd & memory space ...

Post by gapan »

jsfarinet wrote:Eventually, i'd even like to use zram but i do not find it for slackware ...
You cannot find what exactly?

Code: Select all

$ grep -i zram /boot/config
CONFIG_ZRAM=m
# CONFIG_ZRAM_LZ4_COMPRESS is not set
jsfarinet wrote:Actually, i've / and /home set up properly (as xfs), swap is set and also active but for some reason it seem to not work (?).
If it is set up properly, it does work. If it doesn't work, it's not set up properly. Why do you believe it doesn't work in the first place?\
Image
Image
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: a strategy to manage hd & memory space ...

Post by mimosa »

Searching for "zram Slackware" produced these two results at the top of the page:

http://oprod.net/compress-ram-with-zram-in-slackware/
http://www.linuxquestions.org/questions ... 175547961/

But you probably don't need to worry about swap or any substitute for it.
User avatar
jsfarinet
Posts: 305
Joined: 23. Nov 2014, 07:32

Re: a strategy to manage hd & memory space ...

Post by jsfarinet »

mimosa wrote:a) I would omit step 3 till you have successfully rebooted and it works! Step 2: you will end up with directory /usr at the top of the fs in sda5, but you don't want that because youa re going to mount the whole partition as /usr, so:

Code: Select all

cp -r /usr/* somedir
should be fine in this case, but I vaguely rememebr that cp can sometimes miss things (such as hidden files, which shouldn't be an issue here). As a general principle, it is probably best to use rsync. I just mention this as something to bear in mind and possibly investigate. Also, never delete anything you are backing up or moving till 100% sure all went to plan, see above.
Excellent advice re cp to sda5 or rsync! I didn't hink of that, thanks. Sure, i'd not delete anything until the new setup won't work as expected.
mimosa wrote:Then you need to add a line in fstab to mount /usr on the partition.
Here i have a question - my idea for fstab would be like this:

Code: Select all

/dev/sda1        /      xfs   defaults    1   1
/dev/sda3        /usr   xfs   defaults    1   1
/dev/sda4        /home  xfs   defaults    1   2
/dev/sda2        none   swap  defaults    0   0
#/dev/cdrom      /mnt/cdrom       auto        noauto,owner,ro,comment=x-gvfs-show 0   0
/dev/fd0         /mnt/floppy      auto        noauto,users,rw,umask=00 0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       defaults         0   0
tmpfs	   /tmp		  tmpfs       nodev,nosuid,size=3G	0  0
Should sda3 be mounted together with root or not. IOW, the last value should be >1< or >2< ?

A second question regards tmpfs: tmpfs /dev/shm was there by default. It must have been put during the installation. The last line i got from the gentoo wiki (in some way i consider them very technical people ;) ). Sounds that reasonable to you? In any case for me i'm of the idea that tmpfs is better, since it uses ram only, when needed and only as much as needed; and when the limit (i gave) of 3 gig would be excessed it would swap into the swap partition. Sure you're right, with 16 gig ram, swap is not that much of a problem, but i want /tmp as tmpfs exactly as you guessed, for security reasons (to be automatically wiped at shut down).

And finally, i think i have a problem with swap, since the machine fails to get awaken from hibernation (suspend-to-disk). Or do i have to put some statement into the lilo config to make the computer "swap aware" - at least for the hibernation?
User avatar
gapan
Salix Wizard
Posts: 6361
Joined: 6. Jun 2009, 17:40

Re: a strategy to manage hd & memory space ...

Post by gapan »

jsfarinet wrote:Should sda3 be mounted together with root or not. IOW, the last value should be >1< or >2< ?
Doesn't matter. Read the fstab manpage to learn what those numbers are. They are not what you think they are.
jsfarinet wrote:A second question regards tmpfs: tmpfs /dev/shm was there by default. It must have been put during the installation. The last line i got from the gentoo wiki (in some way i consider them very technical people ;) ). Sounds that reasonable to you? In any case for me i'm of the idea that tmpfs is better, since it uses ram only, when needed and only as much as needed; and when the limit (i gave) of 3 gig would be excessed it would swap into the swap partition. Sure you're right, with 16 gig ram, swap is not that much of a problem, but i want /tmp as tmpfs exactly as you guessed, for security reasons (to be automatically wiped at shut down).
Yes, that's OK.
jsfarinet wrote:And finally, i think i have a problem with swap, since the machine fails to get awaken from hibernation (suspend-to-disk). Or do i have to put some statement into the lilo config to make the computer "swap aware" - at least for the hibernation?
You need "resume=/dev/yourswappartition" to be added in the append line in your lilo.conf
Image
Image
User avatar
jsfarinet
Posts: 305
Joined: 23. Nov 2014, 07:32

Re: a strategy to manage hd & memory space ...

Post by jsfarinet »

gapan wrote:
jsfarinet wrote:Eventually, i'd even like to use zram but i do not find it for slackware ...
You cannot find what exactly?

Code: Select all

$ grep -i zram /boot/config
CONFIG_ZRAM=m
# CONFIG_ZRAM_LZ4_COMPRESS is not set
jsfarinet wrote:Actually, i've / and /home set up properly (as xfs), swap is set and also active but for some reason it seem to not work (?).
If it is set up properly, it does work. If it doesn't work, it's not set up properly. Why do you believe it doesn't work in the first place?\
Thanks gapan! For zram i thought of a script which would be executed automatically on boot. Like this one, which is written for OpenRC: https://github.com/vaeth/zram-init. As you can see it overwrites the defaults (which would mean that for any processor would be created a zram device - with this icore 7 would mean 8!). So, i hoped to find a similar script here in the slackworld, wherefrom i could start (and tweak it then to my needs).

For the swap, see my answer to mimosa. Essentially, the computer does not awake from a suspend-to-disk.
User avatar
jsfarinet
Posts: 305
Joined: 23. Nov 2014, 07:32

Re: a strategy to manage hd & memory space ...

Post by jsfarinet »

Just a small report: I successfully transfered /usr of th(sda1 to the /usr partition i created (sda3). Then, renamed the original /usr on root to usr-bak and configured /usr in fstab. BUT: It did not work, /usr was not recognized and to reget my environment working was not without pain (because i realized that nearly all tools i'm used to use from commandline - in slackware - sit in /usr.

Having a closer look on root i saw, in slackware, by far most root stuff sits in /usr. So i decided to not insist in having a separate usr partition. But, in case i'd have a space problem on my root partition, what would be a safe strategy to outsource something (besides of "houscleaning") to gain space?
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: a strategy to manage hd & memory space ...

Post by mimosa »

The steps I recommended ought to work, I think, so the logical conclusion is one of us made a mistake. The two things to do are to troubleshoot (but you have already put it back, which would have been easier with a Live USB, by the way) and to seek alternative suggestions, whether by searching online, or waiting for someone here to point out the obvious mistake.

If you do decide to try again, I suggest just leaving the old /usr in place for the time being, for an easier life.
User avatar
jsfarinet
Posts: 305
Joined: 23. Nov 2014, 07:32

Re: a strategy to manage hd & memory space ...

Post by jsfarinet »

The problem is, the live usb should have installed for boot xfs support - which the one i had handy (manjaro openrc pekwm) did not ... :oops:

I think i'll go to make me a grml or gentoo recover usb :)

If i leave usr on the root partition *AND* i activate the usr partition, won't the system be in trouble about a doubled /usr?
Post Reply