First off, a lot of water isn't needed to cook pasta. I can cook enough for one in about 2 1/2" in the bottom of my 8" diameter pot so maybe 1/2 a quart. If it's spaghetti, break it up in maybe 3 sections so that it can all be sunk in the water.
The only time I'd ever come close to using a gallon of water to cook pasta in would be if I was cooking for 12 or more people and using my largest pot.
Same goes for potatoes if I'm boiling them, barely enough water to cover.
What I do with the left over water depends on where I am. If it's okay to drain outside then I do so, usually over the campfire ashes so that they filter the water as it's absorbed in to the soil. My sink is also connected to a 2 1/2 gallon portable 'gray tank' so I can opt to use that if I don't want to dump it outside.
I use so little water for cooking pasta or potatoes that the starch is fairly concentrated...not suitable for washing dishes in, but then there's not much of it anyways.
Potato water, btw, is great for mixing in with the juices from a roast or chicken to make gravy with.