I'm trying to rationalise space by moving my /var directory from its own partition to /, as currently there's a lot of wastage. I've copied /var to /newvar with rsync, and now want to mount /newvar as /var on reboot by creating an entry in /etc/fstab. This is it (using /var-tst for testing):
/newvar /var-tst ext4 loop 0 0
but I'm getting:
mount: /var-tst: failed to setup loop device for /newvar.
/var-tst exists, so that's the problem? The man page for mount states that it will create the necessary /dev loopback device if it isn't specified. Currently there are no loopback devices in the system, and the loop kernel module is loaded.
poc
PS Suggestions on how to move /var without all this jiggery-pokery are also welcome.
On Fri, 16 Aug 2019 13:18:03 +0100 Patrick O'Callaghan wrote:
PS Suggestions on how to move /var without all this jiggery-pokery are also welcome.
What you want is a "bind" mount. Something like this:
/zooty/home /home none rw,bind 0 0
I use this to put /home on a bigger disk than the OS was installed on (and recover /home from previous installs since /zooty/home hangs around).
Of course, I have no idea if something during boot might want /var prior to even looking at the fstab, so this might not work.
On Fri, 2019-08-16 at 13:18 +0100, Patrick O'Callaghan wrote:
I'm trying to rationalise space by moving my /var directory from its own partition to /, as currently there's a lot of wastage. I've copied /var to /newvar with rsync, and now want to mount /newvar as /var on reboot by creating an entry in /etc/fstab. This is it (using /var-tst for testing):
/newvar /var-tst ext4 loop 0 0
but I'm getting:
mount: /var-tst: failed to setup loop device for /newvar.
If you've done what I think, made a new directory inside the system root, and copied your old /var partition contents, then all you should need to do is remove the old /var mount point, rename your new var directory to just var, and let the OS use a /var directory inside /
On Fri, 16 Aug 2019 at 09:18, Patrick O'Callaghan pocallaghan@gmail.com wrote:
I'm trying to rationalise space by moving my /var directory from its own partition to /, as currently there's a lot of wastage. I've copied /var to /newvar with rsync, and now want to mount /newvar as /var on reboot by creating an entry in /etc/fstab. This is it (using /var-tst for testing):
/newvar /var-tst ext4 loop 0 0
but I'm getting:
mount: /var-tst: failed to setup loop device for /newvar.
/var-tst exists, so that's the problem? The man page for mount states that it will create the necessary /dev loopback device if it isn't specified. Currently there are no loopback devices in the system, and the loop kernel module is loaded.
The default scheme has /var as a directory. Can you boot from live media? If so, you could just rename `/newvar` to `/var` and edit fstab.
poc
PS Suggestions on how to move /var without all this jiggery-pokery are also welcome. _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
On Fri, 2019-08-16 at 08:29 -0400, Tom Horsley wrote:
On Fri, 16 Aug 2019 13:18:03 +0100 Patrick O'Callaghan wrote:
PS Suggestions on how to move /var without all this jiggery-pokery are also welcome.
What you want is a "bind" mount. Something like this:
/zooty/home /home none rw,bind 0 0
I use this to put /home on a bigger disk than the OS was installed on (and recover /home from previous installs since /zooty/home hangs around).
That "works" (i.e. doesn't give an error and does mount the directory) ...
Of course, I have no idea if something during boot might want /var prior to even looking at the fstab, so this might not work.
... however the system refuses to boot (SDDM throws an error, then system reboots). Something doesn't like /var being moved around after starting, or doesn't like bind mounts for some reason.
poc
On Fri, 2019-08-16 at 22:25 +0930, Tim via users wrote:
On Fri, 2019-08-16 at 13:18 +0100, Patrick O'Callaghan wrote:
I'm trying to rationalise space by moving my /var directory from its own partition to /, as currently there's a lot of wastage. I've copied /var to /newvar with rsync, and now want to mount /newvar as /var on reboot by creating an entry in /etc/fstab. This is it (using /var-tst for testing):
/newvar /var-tst ext4 loop 0 0
but I'm getting:
mount: /var-tst: failed to setup loop device for /newvar.
If you've done what I think, made a new directory inside the system root, and copied your old /var partition contents, then all you should need to do is remove the old /var mount point, rename your new var directory to just var, and let the OS use a /var directory inside /
That was the first thing I tried, but I can't rename /newvar to /var as /var is "in use" and of course can't be unmounted.
poc
On Fri, 2019-08-16 at 09:58 -0300, George N. White III wrote:
On Fri, 16 Aug 2019 at 09:18, Patrick O'Callaghan pocallaghan@gmail.com wrote:
I'm trying to rationalise space by moving my /var directory from its own partition to /, as currently there's a lot of wastage. I've copied /var to /newvar with rsync, and now want to mount /newvar as /var on reboot by creating an entry in /etc/fstab. This is it (using /var-tst for testing):
/newvar /var-tst ext4 loop 0 0
but I'm getting:
mount: /var-tst: failed to setup loop device for /newvar.
/var-tst exists, so that's the problem? The man page for mount states that it will create the necessary /dev loopback device if it isn't specified. Currently there are no loopback devices in the system, and the loop kernel module is loaded.
The default scheme has /var as a directory. Can you boot from live media? If so, you could just rename `/newvar` to `/var` and edit fstab.
I may have to do that as /var is too central to booting even in single- user mode.
poc
On Fri, 16 Aug 2019 14:11:09 +0100 Patrick O'Callaghan wrote:
That was the first thing I tried, but I can't rename /newvar to /var as /var is "in use" and of course can't be unmounted.
That sort of thing is what live media was invented for :-).
Boot off a live USB stick, mount the system disk in there and rename to your hearts content, because nothing is in use any longer.
If you have selinux enabled, might need to make the magic file that forces a relabel at boot time so selinux won't barf on the new directory.
Hi.
On Fri, 16 Aug 2019 14:12:06 +0100 Patrick O'Callaghan wrote:
On Fri, 2019-08-16 at 09:58 -0300, George N. White III wrote:
Can you boot from live media? If so, you could just rename `/newvar` to `/var` and edit fstab.
I may have to do that as /var is too central to booting even in single- user mode.
I would try to add to the kernel params: init=/bin/bash then: "mount -o remount,rw /", rename the new directory to /var, "sync" and "reboot -f"
It used to work.
On 19-08-16 09:25:36, Francis.Montagnac@inria.fr wrote:
Hi.
On Fri, 16 Aug 2019 14:12:06 +0100 Patrick O'Callaghan wrote:
On Fri, 2019-08-16 at 09:58 -0300, George N. White III wrote:
Can you boot from live media? If so, you could just rename
`/newvar` to
`/var` and edit fstab.
I may have to do that as /var is too central to booting even in
single-
user mode.
I would try to add to the kernel params: init=/bin/bash then: "mount -o remount,rw /", rename the new directory to /var, "sync" and "reboot -f"
It used to work.
Or add to the kernel params "rd.break=pre-pivot". You'll still need the remount. See `man dracut.cmdline`, from `man kernel-command-line`. Booting continues if you exit the shell.
On 8/16/19 6:09 AM, Patrick O'Callaghan wrote:
On Fri, 2019-08-16 at 08:29 -0400, Tom Horsley wrote:
On Fri, 16 Aug 2019 13:18:03 +0100 Patrick O'Callaghan wrote:
PS Suggestions on how to move /var without all this jiggery-pokery are also welcome.
What you want is a "bind" mount. Something like this:
/zooty/home /home none rw,bind 0 0
I use this to put /home on a bigger disk than the OS was installed on (and recover /home from previous installs since /zooty/home hangs around).
That "works" (i.e. doesn't give an error and does mount the directory) ...
Of course, I have no idea if something during boot might want /var prior to even looking at the fstab, so this might not work.
... however the system refuses to boot (SDDM throws an error, then system reboots). Something doesn't like /var being moved around after starting, or doesn't like bind mounts for some reason.
My strong hunch is that boot logging gets clobbered.
:m
On Fri, 2019-08-16 at 08:26 -0700, Mike Wright wrote:
On 8/16/19 6:09 AM, Patrick O'Callaghan wrote:
On Fri, 2019-08-16 at 08:29 -0400, Tom Horsley wrote:
On Fri, 16 Aug 2019 13:18:03 +0100 Patrick O'Callaghan wrote:
PS Suggestions on how to move /var without all this jiggery-pokery are also welcome.
What you want is a "bind" mount. Something like this:
/zooty/home /home none rw,bind 0 0
I use this to put /home on a bigger disk than the OS was installed on (and recover /home from previous installs since /zooty/home hangs around).
That "works" (i.e. doesn't give an error and does mount the directory) ...
Of course, I have no idea if something during boot might want /var prior to even looking at the fstab, so this might not work.
... however the system refuses to boot (SDDM throws an error, then system reboots). Something doesn't like /var being moved around after starting, or doesn't like bind mounts for some reason.
My strong hunch is that boot logging gets clobbered.
Possibly, though it's not clear why (it complains about not being able to write to a log file under /var/log, but /var/log exists). Anyway, it's a secondary consideration and will presumably disappear once I fix the main issue.
poc
On Fri, 2019-08-16 at 11:03 -0400, Tony Nelson wrote:
On 19-08-16 09:25:36, Francis.Montagnac@inria.fr wrote:
Hi.
On Fri, 16 Aug 2019 14:12:06 +0100 Patrick O'Callaghan wrote:
On Fri, 2019-08-16 at 09:58 -0300, George N. White III wrote:
Can you boot from live media? If so, you could just rename
`/newvar` to
`/var` and edit fstab.
I may have to do that as /var is too central to booting even in
single-
user mode.
I would try to add to the kernel params: init=/bin/bash then: "mount -o remount,rw /", rename the new directory to /var, "sync" and "reboot -f"
It used to work.
Or add to the kernel params "rd.break=pre-pivot". You'll still need the remount. See `man dracut.cmdline`, from `man kernel-command-line`. Booting continues if you exit the shell.
OK, that seems to have worked (after remounting /sysroot, which is where the directories actually are at this point).
Thanks to all who responded.
poc
On Fri, 2019-08-16 at 09:20 -0400, Tom Horsley wrote:
On Fri, 16 Aug 2019 14:11:09 +0100 Patrick O'Callaghan wrote:
That was the first thing I tried, but I can't rename /newvar to /var as /var is "in use" and of course can't be unmounted.
That sort of thing is what live media was invented for :-).
Boot off a live USB stick, mount the system disk in there and rename to your hearts content, because nothing is in use any longer.
If you have selinux enabled, might need to make the magic file that forces a relabel at boot time so selinux won't barf on the new directory.
Yes, a 'restorecon -R /var' was required.
poc
On 16Aug2019 13:18, Patrick O'Callaghan pocallaghan@gmail.com wrote:
I'm trying to rationalise space by moving my /var directory from its own partition to /, as currently there's a lot of wastage. I've copied /var to /newvar with rsync, and now want to mount /newvar as /var on reboot by creating an entry in /etc/fstab. This is it (using /var-tst for testing):
/newvar /var-tst ext4 loop 0 0
That isn't what loop is for. loop is for associating a file with a device.
What you want is "bind", not "loop", because you're binding an _existing_ mount to another location.
but I'm getting:
mount: /var-tst: failed to setup loop device for /newvar.
Because /var-tst is a directory, not a file-shaped-like-a-partition.
Example from our home server:
/app8tb/media/video /exports/video none bind,relatime 0 0
PS Suggestions on how to move /var without all this jiggery-pokery are also welcome.
If you want /var to be on /, rsync it as you have done, and just make a symlink as /var.
Really, all you need to do is to remove the /var fstab entry, umount the existing /var mount, rsync /newvar BACK INTO the stub /var mountpoint which is there, scrub /newvar.
No fstab trickery required (other than erasing/commenting the /var line).
Then afterwards you need to decide what to do with the partition you have been using for /var.
Cheers, Cameron Simpson cs@cskk.id.au
On Sat, 2019-08-17 at 09:38 +1000, Cameron Simpson wrote:
On 16Aug2019 13:18, Patrick O'Callaghan pocallaghan@gmail.com wrote:
I'm trying to rationalise space by moving my /var directory from its own partition to /, as currently there's a lot of wastage. I've copied /var to /newvar with rsync, and now want to mount /newvar as /var on reboot by creating an entry in /etc/fstab. This is it (using /var-tst for testing):
/newvar /var-tst ext4 loop 0 0
That isn't what loop is for. loop is for associating a file with a device.
What you want is "bind", not "loop", because you're binding an _existing_ mount to another location.
but I'm getting:
mount: /var-tst: failed to setup loop device for /newvar.
Because /var-tst is a directory, not a file-shaped-like-a-partition.
Yes, I finally got that.
Example from our home server:
/app8tb/media/video /exports/video none bind,relatime 0 0
PS Suggestions on how to move /var without all this jiggery-pokery are also welcome.
If you want /var to be on /, rsync it as you have done, and just make a symlink as /var.
That implies overwriting the existing /var directory entry, which is not possible while the system is running, even in single-user mode.
Really, all you need to do is to remove the /var fstab entry, umount the existing /var mount, rsync /newvar BACK INTO the stub /var mountpoint which is there, scrub /newvar.
/var cannot be unmounted while the system is running (see above).
I did finally solve it following the suggestion from Francis.Montagnac@inria.fr (adding rd.break=pre-pivot to the boot line, then remounting /sysroot etc.)
No fstab trickery required (other than erasing/commenting the /var line).
Then afterwards you need to decide what to do with the partition you have been using for /var.
I'm going to merge it with / (the two are contiguous) but that will have to be via a live USB stick. I know that doing this with LVM would be easy (for certain values of "easy") but I gave up on LVM years ago as it made my head spin :-)
poc
Hi.
On Sat, 17 Aug 2019 12:01:01 +0100 Patrick O'Callaghan wrote:
I did finally solve it following the suggestion from Francis.Montagnac@inria.fr (adding rd.break=pre-pivot to the boot line, then remounting /sysroot etc.)
Correction: that was a suggestion of Tony Nelson (thanks for this tip by the way).
On Sat, 2019-08-17 at 17:59 +0200, Francis.Montagnac@inria.fr wrote:
Hi.
On Sat, 17 Aug 2019 12:01:01 +0100 Patrick O'Callaghan wrote:
I did finally solve it following the suggestion from Francis.Montagnac@inria.fr (adding rd.break=pre-pivot to the boot line, then remounting /sysroot etc.)
Correction: that was a suggestion of Tony Nelson (thanks for this tip by the way).
Yes, my mistake.
poc
On 17Aug2019 12:01, Patrick O'Callaghan pocallaghan@gmail.com wrote:
On Sat, 2019-08-17 at 09:38 +1000, Cameron Simpson wrote:
Really, all you need to do is to remove the /var fstab entry, umount the existing /var mount, rsync /newvar BACK INTO the stub /var mountpoint which is there, scrub /newvar.
/var cannot be unmounted while the system is running (see above).
"umount -l /var" is your friend. See "man 8 umount".
You could (roughly):
mkdir /newvar rsync -a /var/ /newvar/ # note trailing slashes umount -l /var rmdir /var mv /newvar /var
and scrub the fstab entry. Then reboot to make everything use the new tree.
Cheers, Cameron Simpson cs@cskk.id.au
On Sun, 2019-08-18 at 08:06 +1000, Cameron Simpson wrote:
On 17Aug2019 12:01, Patrick O'Callaghan pocallaghan@gmail.com wrote:
On Sat, 2019-08-17 at 09:38 +1000, Cameron Simpson wrote:
Really, all you need to do is to remove the /var fstab entry, umount the existing /var mount, rsync /newvar BACK INTO the stub /var mountpoint which is there, scrub /newvar.
/var cannot be unmounted while the system is running (see above).
"umount -l /var" is your friend. See "man 8 umount".
Nice, I hadn't known about that.
You could (roughly):
mkdir /newvar rsync -a /var/ /newvar/ # note trailing slashes umount -l /var rmdir /var mv /newvar /var
and scrub the fstab entry. Then reboot to make everything use the new tree.
I'll keep it in mind for next time (there's always a next time).
Cheers
poc