« first day (1822 days earlier)      last day (3123 days later) » 

3:30 PM
I have a script that I wan to run at most once an hour. I was planning on setting up a cron job or a systemd timer, but I do not know where/how to best save the last run time. Any suggestions?
 
3:47 PM
@StrongBad i'd probably touch a file in /var/run and stat the modify time to check last runtime.
 
 
1 hour later…
5:05 PM
@casey I like that. Thanks
 
 
2 hours later…
7:32 PM
@StrongBad yes, just beware that /var/run is probably cleaned up on boot—so if you need to keep your last run stamp over reboots, try /var/lib or /var/local
 
 
1 hour later…
8:47 PM
@de
@derobert hi!
 
@ericgramirez hey
 
@derobert I'm on Arch now, on root
 
So you said your /home partition is bootable... I took that to mean you'd set the bootable flag in the partition table. But I guess maybe that's not what you meant?
[And for anyone else following along, we're talking about:
1
Q: Can I change /home partition to /boot?

ericgramirezWhen installing Arch I did (or I though at least) a /, swap and a /boot partition. I just found out that I have a /, swap and /home partition. Which isn't what I had in mind, I just have like 400mb for the /boot partition, but since is a /home partition it's like I won't have any space. Can I c...

 
yes, I set the bootable flag in the partition table, but I thought I was making a /boot partition
I just found out I had a /home partition when the system complained about space
 
ok.
So probably in the installer it first had you set up the partition table, then asked you what to use all the partitions for—and you accidentally picked /home instead of /boot
I'd guess then that the installer didn't use it for booting at all.
If you do an ls -A /home (with your 400MB /home mounted), does it only show home directories? Nothing weird in there, like you'd expect to find in /boot:
 
8:52 PM
Arch doesn't come with an installer (like Ubuntu/Mint does, if that's what you mean). I just followed ths tutorial: linuxveda.com/2015/04/20/arch-linux-tutorial-manual
And a video on youtube
 
anthony@Zia:~$ ls -A /boot/
config-4.0.1-p+           initrd.img-4.2.0-1-amd64  System.map-4.1.0-2-amd64
config-4.1.0-2-amd64      lost+found                System.map-4.2.0-1-amd64
config-4.2.0-1-amd64      memtest86.bin             vmlinuz-4.0.1-p+
grub                      memtest86+.bin            vmlinuz-4.1.0-2-amd64
initrd.img-4.0.1-p+       memtest86+_multiboot.bin  vmlinuz-4.2.0-1-amd64
initrd.img-4.1.0-2-amd64  System.map-4.0.1-p+
Ok, let me look at that tutorial quickly
 
I get:
If I type that
 
you get no output? (And is that on /boot or /home)?
 
@ericgramirez ok... that video around 5 minutes in is creating /mnt/home ...
that appears to be a mistake in the video
talks about mounting the boot partition and then mounts it to /home
 
8:58 PM
ohhh
@derobert Is my problem solvable yet?
:p
 
yeah, those steps in the answer should solve your problem.
You'll be left with some unused space for that former /home partition, but...
 
cas
@derobert's answer is pretty good. only thing i'd change is that it's not necessary to mv/cp /home twice. mkdir /home.new cp -af /home/* /home.new ; fix perms on /home.new (make them same as /home) ; umount /home ; rmdir /home ; mv /home.new /home ; edit /etc/fstab
 
@cas your "home.new" is something like what I meant by put them somewhere...
 
cas
ah, okay. i read it as copying/moving to a temp location and then copying/moving them to final /home
 
@ericgramirez I left a comment on the YouTube video. Maybe GuitarHeroGage will see it and fix it.
@cas well, I'd personally do something like mkdir /foo; mv /home/* /foo; umount /home; chmod /home …; mv /foo/* /home/
 
9:05 PM
@derobert Does it break if I umount /home (since it's bootable)?
 
@ericgramirez The linux bootloaders don't actually pay any attention to the partition bootable flag
 
cas
btw, @ericgramirez, you can do the reverse with /boot if you don't want to waste the disk space used by your old /home partition. 400MB is enough for /boot
@derobert: mv is irreversible, cp isn't. imo best to leave the "point of no return" as late as possible in any mass file-shifting procedure.
 
@ericgramirez (and even if they did, a filesystem's mounted/not mounted state only exists once Linux is booted—the bootloader doesn't know.)
 
@derobert What do you mean when you say: "Fix the permissions on /home. Then move everything from its temporary location to /home (on rootfs)"?
 
@cas Point taken. cp -a is better for that initial one.
 
9:08 PM
@derobert Specifically on the "on rootfs" part
 
@ericgramirez When you mount a filesystem on a directory, the permissions on the mounted filesystem take over. So the permissions on /home (as displayed by ls -ld /home or stat /home) may change when you unmount the 400MB partition.
@ericgramirez Oh! "rootfs" being the root filesystem
 
cas
@ericgramirez the whole point is to move your /home from a separate partition to a subdirectory on the rootfs
 
root filesystem is the one mounted at /
Unlike Windows (for example) where filesystems start at C:\ or D:\, etc., in Unix filesystems start at /, and form a tree structure: each other filesystem appears inside a directory on its parent file system. The top most filesystem is the root filesystem (at /) So you have /home (a directory on the root filesystem) and inside that is where the files stored on your 400MB partition appear.
 
@derobert And when you say to edit the /etc/fstab archive... you mean replacing the "/home" for a "/boot"?
 
@ericgramirez no, just find the line which says to mount /home and comment it out.
You have two things—1, get /home back on the root filesystem, instead of that 400MB one. That's what my answer does.
 
cas
9:13 PM
moving /boot to the partition would be a completely separate operation. and an optional one.
 
That's pretty safe—very unlikely to break anything.
There is a similar operation you could do to move /boot off of the root filesystem and on to that 400MB one, but it's much more likely to make your machine not boot.
 
# /etc/fstab: static file system information
#
# <file system> <dir>   <type>  <options>       <dump>  <pass>
# /dev/sda4
UUID=50bb8e8e-3b51-40a1-a039-a827902db5a6       /               ext4            rw,relatime,data=ordered        0 1

# /dev/sda6
UUID=2b16dfb7-66ac-412c-9684-ad2572c8c139       /home           ext4            rw,relatime,stripe=4,data=ordered       0 2

# /dev/sda5
UUID=4c4f146a-81ea-4e7e-911a-3c96e495db7f       none            swap            defaults        0 0
 
cas
comment out (put a # at the start of) the line with /home on it
 
How can I exclude multiple patterns from a zsh glob? The zsh equivalent of bash's !(*foo|*bar). I can't figure out how to make the zsh ^*foo take multiple patterns.
 
@cas I see, thanks!
 
9:20 PM
@terdon ^(foo|bar)
If you're having a problem, tell us your exact pattern, and what options are active. Zsh syntax is ambiguous and the parser sometimes resolves ambiguities in a surprising way.
for example …(…) might be parsed as a pattern with a glob qualifier at the end rather than a pattern with a final part in parentheses
 
@Gilles Ah, thanks, that did it.
I was putting the ^ inside the parentheses for some reason.
 
9:42 PM
@derobert Why do I need to move everything out of /home and then into it?
 
@ericgramirez You're moving everything out of the 400MB filesystem
Then you unmount the 400MB filesystem, which makes it so that you see the contents of the folder on the parent filesystem (the root filesystem)
Then move the stuff into that folder, on the root filesystem
 
@derobert Got it, thanks!!
 
It's basically a workaround that once you unmount the 400MB filesystem, you can't see its contents anymore—so you have to copy them off before unmounting
BTW: If after rebooting the 400MB filesystem gets mounted on /home again (e.g., because you didn't edit fstab, or because you have an initramfs doing it—don't think Arch does) your files will appear to vanish. That's because they're being hidden by the empty 400MB filesystem. They're not gone, just umount /home and they're re-appear.
 
I commented the line
But now I have a /boot partition?
 
No. We haven't create one.
You just have an unused filesystem.
 
9:47 PM
How can I proceed?
 
I wouldn't worry about not having a /boot partition.
 
@derobert And how come it boots anyway?
 
The files needed for booting are on the root partition. A separate /boot partition was last needed (for a basic setup like yours) errr.... maybe early 2000s?
Or late 90s.
It used to be a workaround for BIOSes that could not read sectors beyond, I think it was 1GB, those were BIOSes from when 1GB was a lot of space.
 
@derobert So it boots even if I hadn't set the root partitio bootable. Then why I need to make a partition bootable? (Sorry if I'm asking a lot, I just want to learn)
 
@ericgramirez Linux bootloaders ignore that flag. You don't need to set the partition bootable.
Some old BIOSes cared, some old bootloaders cared.
Now you'd just set it as a way to document (for display purposes) that a partition is bootable.
 
9:54 PM
@derobert Interesting :) I really thank you. Have a nice day
 
Yeah. The PC BIOS architecture dates from, errr, the early 80s? There is a bunch of old cruft in there, unfortunately.
Or on new machines you can use UEFI instead, and get brand new cruft!
 

« first day (1822 days earlier)      last day (3123 days later) »