I listed tank sizes in liters, not gallons. To convert liters to gallons, multiply by 0.26. A 4 inch (10 cm) Lysiosquillid could easily live for years in a 20 gal aquarium but not if it is completely full of sand. The animal to start will need a sand bed two (preferably 3) times deeper than it is long. That means you need a sand bed about a foot (30 cm) deep. If you put that much sand into a standard 20 gal tank, there will not be enough space for water. There are a couple of possible solutions.
1. Use a bigger and/or taller tank. Hex tanks work well as do the tall 30 gal tanks commonly for sale.
2. Use a smaller tall tank (I make mine to be 5 or 6 inches wide, 18-24 inches long and 15 - 30 inches deep depending on the size of the animal.) I can fill them 3/4 full of and and either attach them to a sump or as a satellite to another system. Some of the larger hang-on refugia work well for this.
3. Divide a tank and only put sand in one side. This is my favorite way to go. You can take a 20 gal and have a piece of glass or plexiglass cut to just fit inside running the length of the tank and tall enough to come within a couple of inches of the top. If the tank is clean and dry, you can seal it in place leaving about a 5 inch wide compartment. Then fill this about half full with sand. After the animal digs a burrow (this can take weeks), you can slowly add more sand to bring the level up to nearer the top of the partition. You can keep live rock, coral, etc. in the other part of the system. If you want to keep fish or other stomatopods, you should use a screen partition extending up from the glass partition. Just make sure that it is sufficiently course to allow good flow.
You can also convert an aquarium that is already up and running. The problem is that you can't glue the partition in place. I cut a piece of plexiglass to fit and line the bottom and side edges with a thin strip of foam weather stripping. I move all the occupants, LR and sand to the back of the tank, insert the partition and hold it in place with plexiglass spacers cut to fit on the bottom and top. Using this technique, if you decide to get rid of the sand containing compartment, you can simply siphon out the sand and remove the partition and spacers.
Roy