LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-28-2017, 05:39 AM   #1
ajohn
Member
 
Registered: Jun 2011
Location: UK
Distribution: OpenSuse Leap
Posts: 122

Rep: Reputation: Disabled
Why do I have problems changing a drive with /var on it ?


I switched to what I call a system disk on an ssd some years ago. Effectively I mount / to that and then to reduce writes mount /tmp and /var to a hard drive. I did have /swap mounted on this drive as well but now run without swap. No need with 24gb of ram. I should mount more in that. I also mount /home to a raid on hard drives.

I upgrade the drives in my machine recently after a distro release upgrade. Chose to upgrade the distro before changing drives to see just what happened. I prepared the new drives in a usb dock formatted to ext4 and also created the partitioning. / is still on the same ssd. When I boot dmesg shows a pending job that just times out and I finish up booting to the console.

I also changed to mount by label so that I could identify which disk is which. Especially useful on my /home raid if one fails. That doesn't seem to have caused the kernel any problems finding them so that doesn't seem to have caused the problem.

I can't see how /tmp could cause a problem so it looks to be /var. Any ideas as to why? I also used different partition sizes at one point which again shouldn't cause problems but using the same ones has the same result.

I'm left thinking that maybe boot needs something left in /var from the last boot up but haven't a clue why this happens. There are some logs written to /var including software updates but I can't see why loosing those should cause a problem.

John
-
 
Old 07-28-2017, 11:34 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, RPi OS, Mint & Android
Posts: 13,013

Rep: Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727
You have /tmp & /var on a separate hard drive. The system updates both, so you need them. I trust /tmp & /var exist on / and they are in separate partitions mounted at some point in the boot sequence.

Up to that point, the system will write in /tmp & /var on the ssd, and the contents (If any) will become invisible and unavailable once you mount the hard drive partitions on the ssd. That has the potential for causing trouble. If any of this guesswork is incorrect, please clarify your setup precisely and fully. It's better not to leave me guessing.

It would be good to boot on a live cd, unmount /tmp & /var partitions, and see if anything is in /tmp or /var. Then post /etc/fstab and any syslog or dmesg disk errors. Don't spam us with the whole log, just what's suspicious. Guys will post 100k and expect me to read it for some reason, although they clearly haven't bothered themselves.
 
Old 07-28-2017, 02:43 PM   #3
ajohn
Member
 
Registered: Jun 2011
Location: UK
Distribution: OpenSuse Leap
Posts: 122

Original Poster
Rep: Reputation: Disabled
/tmp and /var aren't mounted and don't even exist on the ssd. They are separate partitions on a disk as was swap. It has been like that since I installed from scratch. For some years actually and a recent update used the same partitioning.

The problem comes when I try to replace the disk with /tmp and /var on it. I prepare the disk exchange it for the original one and it fails to boot completely as detailed in my original post. A pending job that eventually times out. This occurs shortly after the mounts are found. ie a few lines after. I can't post part of dmesg as I have gone back to using the original disk.

I had already checked that these mounts are where I intended with a Knoppix boot usb stick.

Fstab is exactly as it should be to mount like this. I have been running this set up for several years.

Code:
/dev/disk/by-id/ata-PLEXTOR_PX-128M5Pro_P02306101219-part2	/	ext4	acl,user_xattr 1 1 
/dev/disk/by-id/ata-PLEXTOR_PX-128M5Pro_P02306101219-part1	/boot/efi	vfat	umask=0002,utf8=true 0 0 
/dev/disk/by-id/ata-VB0250EAVER_Z3TCNPGW-part4	/home/home2	ext4	noacl,user_xattr 1 2 
/dev/disk/by-id/ata-VB0250EAVER_Z3TCNPGW-part3	/tmp	ext4	acl,user_xattr 1 2 
/dev/disk/by-id/ata-VB0250EAVER_Z3TCNPGW-part2	/var	ext4	acl,user_xattr 1 2 
/dev/md0             /home               ext4       acl,user_xattr,data=writeback  1 2
I'm not keen on how OpenSuse usually defaults to by id on disks. One version of fstab I tried to get round that with the new disk is this one
Code:
/dev/disk/by-id/ata-PLEXTOR_PX-128M5Pro_P02306101219-part2	/	ext4	acl,user_xattr 1 1 
/dev/disk/by-id/ata-PLEXTOR_PX-128M5Pro_P02306101219-part1	/boot/efi	vfat	umask=0002,utf8=true 0 0 
LABEL=wdtmp  /tmp   ext3   acl,user_xattr   1 2
LABEL=wdvar  /var   ext3   acl,user_xattr   1 2
/dev/md0             /home               ext4       acl,user_xattr,noatime        1 2
LABEL=extra /home/home2 ext3 noacl,user_xattr 1 2
Boot had no problems finding them so the problem is pending job etc.

I also dual boot to lxde using the same style of mounting using the same /tmp but a different /var partition. This is it's fstab
Code:
LABEL=swp swap swap defaults 0 0
LABEL=SSDsys2 / ext4 defaults 1 1
UUID=8442-722C /boot/efi vfat umask=0002,utf8=true 0 0
UUID=a6950e00-1198-4554-ab22-9ba4667ad917 /home ext4 
defaults 1 2
LABEL=spare /home/home2 ext4 defaults 1 2
LABEL=temp /tmp ext4 defaults 1 2
LABEL=var2lxde /var ext4 defaults 1 2
No problems at all but this is a fresh install - not a change of disks with the same partitioning. OpenSuse decided to use uuid's this time. I think that is the default now. Home is still mounted to the raid. LXDE just uses a different user name.

John
-
 
Old 07-28-2017, 07:58 PM   #4
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010
Quote:
Originally Posted by ajohn View Post
I'm left thinking that maybe boot needs something left in /var from the last boot up but haven't a clue why this happens.
Boot uses /var/run. So, you might need to edit initrd to mount /var early. /var/run is just an empty directory.

From my research, you don't need to limit drive writes to a SSD.
 
Old 07-29-2017, 03:25 AM   #5
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, RPi OS, Mint & Android
Posts: 13,013

Rep: Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727
Agreed you don't need to limit writes to an ssd. Limit atime. I'm on an ssd and use these options:
Code:
/dev/sda3  / ext4 noatime,diratime,discard 1   1
My point was that under / there will have to be a /tmp directory and a /var directory if you are ever to mount the partitions on /tmp & /var.It's good to check with the drives unmounted that those directories are actually empty. Otherwise you are introducing problems in the boot sequence. That will require booting from a partition other than / and I suggested a live cd.

I also feel you're over complicating things for yourself. I don't like labels, and would list /var & /tmp immediately after / if you absolutely have to do it that way. I can understand a different disk for /home. I also like to keep one system on one drive. You must be swimming in poorly utilised disk space.
 
Old 07-29-2017, 04:18 AM   #6
ajohn
Member
 
Registered: Jun 2011
Location: UK
Distribution: OpenSuse Leap
Posts: 122

Original Poster
Rep: Reputation: Disabled
Var is far from empty. I'd guess that things appear in it when the system has booted up so I used spaceFM to examine the one for my lxde boot from my kde boot. SpaceFM does the same sort of thing as many bootable iso/usb systems do - it mounts all partitions that are on the disks, those that aren't active are mounted to media. Had to attach a screen shot jpg to show this.

Rant. KDE's screenshot - Spectacle has been updated. Select a rectangular region no longer works and the thing autosaves to the photo directory rather then somewhere some one may want to put them.

spaceFM's properties snip - it's definitely not empty. Also shows me that my install uses decimal rather than binary to make alignment more difficult. I had wondered about that.

Code:
DEVICE
/dev/sdb5 internal mounted
 on /run/media/john/var2lxde type ext4 (rw,nosuid,nodev,noexec,noatime,data=ordered,uhelper=udisks2)

USAGE
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/sdb5      ext4  9.6G  638M  8.5G   7% /run/media/john/var2lxde
John
-
Attached Thumbnails
Click image for larger version

Name:	Var.jpeg
Views:	11
Size:	50.2 KB
ID:	25600  
 
Old 07-30-2017, 03:27 AM   #7
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, RPi OS, Mint & Android
Posts: 13,013

Rep: Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727
Let me try and extract some information from you.
Code:
Var is far from empty.
Please explain. Is this the output of 'ls /var' when booted, or is this the contents of the ssd /var directory when the /var partition is not mounted? If the latter, please post the output of 'ls -lt </path/to/SSD/var> with the partition unmounted.

Why did you give us detail on /run/media/john/var2lxde? What's that about?
Re the rant:
Are you just frustrated with kde? This is linux, and you don't have to put up with anything you don't like. When one version of these larger DEs is released, it seems like there are guys with no other life who immediately start rewriting it, and debating for weeks whether to put a 'terminals' submenu in Accessories, Utilities, System Tools, or somewhere else. It's important to them that they move everything to justify their existence, and prevent you ever getting to know your DE.

Last edited by business_kid; 07-30-2017 at 03:39 AM.
 
Old 07-30-2017, 06:24 AM   #8
ajohn
Member
 
Registered: Jun 2011
Location: UK
Distribution: OpenSuse Leap
Posts: 122

Original Poster
Rep: Reputation: Disabled
I can boot to 2 desktops on my machine. Same distro but totally different installs. /var is a system directory, some give odd results when looked at like this. Some confusion on my part too so I posted /var forgetting that some one had mentioned that it was /var/run that was an empty directory. Checking with spaceFM again on the one for my LXDE boot it's actually a link to over 40 other directories, a few files and a few links.

This is what I get on the mounted one that is being used while I post this.
Code:
ls /var/run
agetty.reload  dbus                fontpackages  log          media      openvpn            rsyslog       sddm.pid       tmpfiles.d  user
auditd.pid     dirmngr             fsck          lvm          mount      pcscd              rsyslogd.pid  SuSEfirewall2  tuned       utmp
avahi-daemon   displaymanager.pid  initramfs     lvmetad.pid  netconfig  pesign             samba         svnserve       udev        vpnc
cron.reboot    dmeventd-client     lirc          mcelog       nscd       plymouth           screens       sysconfig      udisks2     wicked
cups           dmeventd-server     lock          mdadm        ntp        regenerate-initrd  sddm          systemd        uscreens    zypp.pid
Maybe this is why I have the boot problem when I change the drive. I've just created a /var partition on it. Perhaps I need to copy /var/run across. Maybe there are others with a similar problem. Perhaps the best option is to rsync the lot across but depending on how "obscure" the set up really is even that might not work.

The easiest option would have been to change the drives before I updated the lot - same as a reinstall but I was curious on the whole subject of changing disks on the fly rather than re installing. I've seen posts elsewhere suggesting that it can be a problem. Usually from people who use just one disk/ssd and want to fit a larger one. Also adding a /home drive - use a bootable iso etc. It can be done in a console from the desktop.

Rant - well. I'm well aware that I am not stuck with kde and am beginning to wonder even after over 15 years of using it. Changes seem to be more whim like more often these days. Also drifting towards all people do on PC's is video's, photo's and doc's. Sort of forgetting that if some one has lots of any of them they will want to organise them themselves. So far though they haven't tied in file indexing and cataloguing into everything they provide. Big mistake on V4. I have all of it disable on V5 at the moment and may bring some back up. That aspect rules some maybe all Gnome based desktops out for me.

John
-
 
Old 07-30-2017, 09:48 AM   #9
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, RPi OS, Mint & Android
Posts: 13,013

Rep: Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727
The absolute easiest way to handle this is to let /var & /tmp exist on the ssd. Stop mounting partitions on them, and adjust the ssd options in /etc/fstab to the ones recommended a few posts ago. As long as you keep an eye on them, no major space is needed.

On the desktop environments, I suggest you'll have to painfully extricate yourself from kde use, and give a few others a try. I use XFCE, which is light, and have a Mint VM which has Cinnamon which is nice but heavier but it hasn't the runaway madness of gnome or kde. I've heard people say good things about several newer DEs.
 
Old 07-30-2017, 02:02 PM   #10
ajohn
Member
 
Registered: Jun 2011
Location: UK
Distribution: OpenSuse Leap
Posts: 122

Original Poster
Rep: Reputation: Disabled
The best place for /tmp in many ways is in ram if the space needed is available. Some also keep var/log in ram. If needed it's available approach. I'd fully agree that the easy way is just to mount the lot to / including /home but some would strongly suggest having /home on a separate drive/ssd however of late there is a lot of user config kept off user home so the usual reason for keeping home separate may not really apply now due to that. It did mean that an update was relatively easy - just avoid formatting user home when installing. I've had updates make changes to config off ~ so that aspect might not be as easy as it was. That looks to be a feature of all desktops now thanks to the xdg specifications. That also allows directory setting to be moved though.

Spectacle will get fixed and it can save where I want but defaults to somewhere else. KDE's runaway was V4. It didn't cause me much of a problem because of the distro I run. KDE gets more bad press than it deserves really. I mentioned on another thread that LXDE is slightly less responsive than KDE. Not surprising really. It uses less memory. I also mentioned that I ran final KDE4 on a netbook with 2gb ram. It was ok and way way quicker than the windoze that was on it and made it usable. No point trying V5 until a longer term release comes out.

I'd worry more about the coming of Wayland and probably wider use of Qt if I were you. I have yet another /var space available on the disk to install an XFCE boot but am tied up elsewhere off the PC at the moment. I expect the same behaviour as LXDE for the same reason.

I suspect I have just found out why replacing and existing /var isn't straight forwards. I'll try initialising it with the old one when I have a spare hour or so.

John
-
 
Old 08-01-2017, 04:49 AM   #11
ajohn
Member
 
Registered: Jun 2011
Location: UK
Distribution: OpenSuse Leap
Posts: 122

Original Poster
Rep: Reputation: Disabled
Looking around it looks like /var/run usage changed some time ago and was replaced by /run and that can be implemented by converting /var/run to a link to /run.

I'd assume that all of the directories in /var are created during install so suspect that all will be ok if the directory structure is created on a replacement disk or partition. That assumes that various things in there can start again from scratch. Seem that should by definition of /var but that might not be the case so may as well copy the lot across.

Dolphin reckons that there is just sub 1gb in /var - spaceFM more like 2gb. I've had reason to question Dolphins view of things before.

John
-
 
Old 08-02-2017, 02:05 AM   #12
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010
/var/run is full of virtual files. If you examine it on a cold system there is nothing there. But some distros unpack initrd to /var/run.
 
Old 08-07-2017, 04:31 AM   #13
ajohn
Member
 
Registered: Jun 2011
Location: UK
Distribution: OpenSuse Leap
Posts: 122

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by AwesomeMachine View Post
/var/run is full of virtual files. If you examine it on a cold system there is nothing there. But some distros unpack initrd to /var/run.
The attachment shows what my /var seems to hold. It's my LXDE boot /var/run taken from my KDE boot so is cold.

I suspect my problem with replacing the disk that has /var on it is the need to duplicate the directory structure. /var/run is a link but I had no idea that a link could go to so many other directories.

John
-
Attached Thumbnails
Click image for larger version

Name:	Cold_LXDE_VAR.jpeg
Views:	8
Size:	64.3 KB
ID:	25667  
 
Old 08-08-2017, 04:09 AM   #14
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, RPi OS, Mint & Android
Posts: 13,013

Rep: Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727
Personally, I think there's been too much attention given to /var/run. /var/lib & /var cache, for instance, are 2 other important directories in /var.

The issue here is this: Some time after / is mounted, other partitions are mounted. If you're mounting partitions on /var & /tmp, any files written to them between the time / is mounted and they are settled as mounted will become invisible to the system. That may not bve a problem today, but it could be after a kertnel update, or a change from sysvinit to systemd or some such, and it will be a bitch to find.

You are better not mounting partitions on /var & /tmp, & protecting your ssd with fstab option like I listed.
 
Old 08-09-2017, 05:32 AM   #15
ajohn
Member
 
Registered: Jun 2011
Location: UK
Distribution: OpenSuse Leap
Posts: 122

Original Poster
Rep: Reputation: Disabled
True but the reason for the post was that my set up does have /var on a separate disk to / and I want to replace it. I've also used a modestly priced ssd for about 5 years without problems. I know other people who have had problems. They have moved on a lot since then. Also some of them now give an idea of write life in their specs. I do wonder though if price in part reflects on the probability of a warrantee claim. There are also bound to be clones about - always been a problem with flash memory.

On my next distro update I will be changing to all flash and adding a nas of sorts purely for backup. Having had a power fail problem even with journaling enabled I'm likely to disable that and add a UPS instead. In the scheme of things they aren't that expensive these days. I have no need for a high power capacity one. My workstation takes about 125w with 3 drives and an ssd and no power saving.

When I do change to ssd I'll be using 2. One for / and one for /home. Out of curiosity I might add a 3rd and direct the majority of "system" writes to it. Having 24gb of memory /tmp will definitely be going to ram plus anything else that I can put in it. The highest ram usage I see is 6gb but the vast majority of that is purely down to firefox. I don't use a swap partition. Doesn't seem to be any point.

I have to take the 6gb back - I've been doing some photo work and lot's left in memory that I no longer need

Code:
free -h && sync && echo 3 > /proc/sys/vm/drop_caches && free -h
             total       used       free     shared    buffers     cached
Mem:           23G        12G        11G       184M       678M       9.2G
-/+ buffers/cache:       2.3G        21G
Swap:           0B         0B         0B
             total       used       free     shared    buffers     cached
Mem:           23G       2.9G        20G       184M       1.7M       620M
-/+ buffers/cache:       2.3G        21G
Swap:           0B         0B         0B
Sub 3gb is pretty typical once the cache is cleared. KDE 5 when it's finished may not need that much. Final 4 was fine on a netbook with 2gb of memory. Probably not for photo work though. Browsing etc fine.

John
-
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
permissions on /var/run/screen changing after reboot fakie_flip Linux - Software 5 02-20-2013 02:59 PM
Changing file permissions of generated /var/log files jeriryan Linux - Security 2 06-13-2012 09:25 AM
Changing /var/spool/mail/$USER to ~/Maildir Aardvark Linux - Server 2 06-30-2009 10:32 AM
Changing user and group for Apache 2 & /var/www RDReavis Debian 4 04-06-2009 04:32 AM
Changing ownership of directories; /var/log/messages questions Micro420 Linux - General 6 04-21-2006 08:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration