Script to replot OG plots one at a time

Are there any scripts available that could replace existing OG plots with portable plots, one at a time? For example, I would like to delete one OG plot and then kick off a Madmax pot to replace it. This would repeat until all of the OG plots on the drive have been replaced.

2 Likes

I have a move script in bash/powershell that I am going to adjust to just check the drive and if there are plots before 20210708(or whatever date your last old plot was writen), delete one and then write a new one.

I will be done plotting all my HDD the old way tomorrow and will start from that date. Just waiting for everyone to find the bugs in the new pooling first:)

Yes, I was thinking I would make a shell script if there isn’t already a script that could do this. I just thought someone’s Python script might be more capable than my own shell script would be.

I agree that the plot date is probably the only way to determine which plots to replace. Based on the pooling Q&A video, it sounds like there isn’t a way to tell them apart otherwise.

You could solve it by plotting new pool plots to a subdirectory inside the destination drive, then delete the plots outside that subdirectory one by one with a script.

I found a shell script that deletes by timed delay:

Here is a very basic script that monitors a folder for new files with inotify-tools.
It deletes an old plot when a new one is writing to disk.

#!/bin/sh
new_plots="/mnt/driveX/portable-plots"
old_plots="/mnt/driveX/plots"
inotifywait -m -e create  --format '%w%f' "${new_plots}" | while read NEWFILE
do
        echo ""
        echo "# NEW PLOT: 		${NEWFILE}"
		plot_file=$(/usr/bin/find "$old_plots" -iname "plot-k*.plot" |/usr/bin/sort -R |head -1)
		if [ -f "$plot_file" ]; then
		      echo "# REMOVING OLD PLOT: 	$plot_file"
		      rm -f $plot_file
		fi
done
3 Likes

I haven’t tried it but looks promising.

Only problem with this one is that you need to wait for the final copy to the destination drive while using madmax. With madmax only, a plot takes around 30min to create, with this it taket around 40min due to wait for copying.

1 Like

I think you can mitigate it by just having the destination of the finished plots on a different folder in the same SSD then run a robocopy script to move to the final HDD destination.

Sounds good, could you provide a step by step toturial on how to setup this “robo copy” script?

I got the robocopy script from this website.

For Windows users, the v1.0 script here should help… https://chiaforum.com/t/copy-plots-to-various-destination-disks-based-on-input-files
Relies on a seperate process running thats doing the plotting.

1 Like

I looked at some more complex approaches and went for the easiest I could think of, I run plotman on 4 plotters and it will archive plots using rsync to one farmer with space for 3000 plots, that space was all filled with OG plots.

At any time I need to have 4 free spaces (2996 plots) - so every 5 mins I run a python script on a systemd timer which deletes up to 4 plots created before 7 July, selected at random. This means I will be 4 plots under capacity until I have replaced all of those OG plots, but I can live with that.

Thank you for posting this useful script @Mikal! Below is a slightly modified version of the script that deletes the oldest plot file first. The advantage that this offers is that it could be used to replace the old plots with new plots in the same folder. This would be done by simply setting the new_plots and old_plots to the same folder. Then start Madmax with the plot quantity set to the number of files in the folder. Of course, there needs to be room for one plot on the drive before starting the plotter.

I did have to change this to a bash script to allow redirection in Ubuntu.

#!/bin/bash
new_plots="/home/farm/portable"
old_plots="/home/farm/og"
inotifywait -m -e create  --format '%w%f' "${new_plots}" | while read NEWFILE
do
    echo ""
    echo "# NEW PLOT: 		${NEWFILE}"
	file_string=$(/usr/bin/find "$old_plots" -type f -iname "plot-k*.plot" -printf '%T+ %p\n' | /usr/bin/sort | head -n 1)
	read -ra file_array <<<"$file_string"
	plot_file=${file_array[1]}
	if [ -f "$plot_file" ]; then
		echo "# REMOVING OLD PLOT: 	$plot_file"
		rm -f $plot_file
    fi
done
3 Likes

I’m surprised there aren’t more scripts on the forum to deal with moving plots and replace OG plots. I’m using a combination of PSchiaplotter, madmax, and porkopops script, but I haven’t found an ideal solution for me yet. I’m going to look into using windows power automation. It looks like a great logic tool that writes the actual syntax for you. Using Windows Power Automate Desktop to move plots

I would strongly suggest keeping OG and portable plots separated since the date would be the only way to tell the difference between them, and farming is done by folder, not date.

that is awesome!

MrPig has now updated his PSChiaPlotter to version 1.0.53 that fixes this issue!

No additional script is needed.

Latest version: Release v1.0.53 PSChiaPlotter 2021-07-15 · MrPig91/PSChiaPlotter · GitHub

“Added: 1. The ability to start a new plot while the previous plot is copying to the final directory using the “Plot While Copy” feature”