"Root hog or die" is a common American catch-phrase dating at least to the early 1800s. Coming from the early colonial practice of turning pigs loose in the woods to fend for themselves, the term is an idiomatic expression for self-reliance.

The word "root" is used as an imperative verb, as is "die". The phrase (sometimes rendered with commas after root and hog) can be parsed as, "Root (search for roots to eat), hog, or [you will] die."

Early examples of use
1829: "In Ohio, they have a vulgar proverb which runs thus—"Root, hog, or die." It is usually spread in staring capitals among idlers and it is said often has an admirable effect in promoting habits of industry." —Vermont Gazette (March 17, 1829)
1834: "We know'd that nothing more could happen to us if we went than if we staid, for it looked like it was to be starvation any way;  we therefore determined to go on the old saying, root, hog or die." —Davy Crockett, A Narrative of the Life of David Crockett, of the State of Tennessee.

Songs
The term resulted in several songs with the same theme.

"Root Hog or Die" (c. 1854)
Several songs of unknown authorship were published before the Civil War, including patriotic and minstrel songs. A patriotic version opens with:
I'll tell you a story that happened long ago,
When the English came to America, I s'pose you all know,
They could'nt whip the Yankees, I'll tell you the reason why,
Uncle Sam made 'em Root Hog or Die.

"Root, Hog, or Die" (1856)
The most popular song of the era was a minstrel song variously titled "Root, Hog, Or Die" or "Do Jog Along", sometimes credited to George W.H. Griffin, which was first copyrighted in 1856. Many variations exist—a common first verse is:
I'm right from old Virginny wid my pocket full ob news,
I'm worth twenty shillings right square in my shoes.
'It doesn't make a bit of difference to neither you nor I
Big pig or little pig, Root, hog, or die.

"Root Hog or Die" (1858)
A song from the gold field camps on the front range of the Rockies written by A. O. McGrew in 1858 addressed the hardships of gold miners.  It was first sung at a Christmas party near present-day Denver.  The first verse:
Way out upon the Platte near Pike's Peak we were told
There by a little digging we could get a pile of gold,
So we bundled up our clothing, resolved at least to try
And tempt old Madam Fortune, root hog or die.

Civil War songs
Both sides in the Civil War had root, hog, or die songs. A verse from "Flight of Doodles", a Confederate song, is typical:
I saw Texas go in with a smile,
But I tell you what it is, she made the Yankees bile;
Oh! it don't make a nif-a-stifference to neither you nor I,
Texas is the devil, boys; root, hog, or die.

"A Philosophical Cowboy"
A folk song collected in 1911 tells of the hard life of the cowboy. The last verse is:
Sometimes it's dreadful stormy and sometimes it's pretty clear
You may work a month and you might work a year
But you can make a winning if you'll come alive and try
For the whole world over, boys, it's root hog or die.

This version, and variations of it, are still recorded.

Newer versions have also been recorded.

Woody Guthrie recorded a version "Root, Hog & Die" about the trial of Sacco & Vanzetti, changing the narrative to that of a man racing to get to Boston before their scheduled execution in 1927.
Root, hog and die friend, Root, hog & die
Gotta get to Boston, Root, hog & die
Sacco & Vanzetti die at sundown tonight
So I gotta get to Boston, Root, hog & die

June Carter Cash had a minor hit in 1950 with her version, now available on YouTube with guitar by Chet Atkins. The first verse is as follows:

When I was young and pretty
With a twinkling in my eye
I met a traveling man one day
And I guess he told a lie

When we was a courting
He called me sugar pie
Now he calls me other names
It's root, hog, or die

Root, hog, or die
Tell you the reason why
I met a traveling man one day
And I guess he told a lie

References

Bibliography
—. "Root Hog or Die" (broadside). Philadelphia: J.H. Johnson (c. 1854).
Crockett, David. A Narrative of the Life of David Crockett of the State of Tennessee. Philadelphia: E.L. Carey and A. Hart (1834).
Davidson, Levette Jay. Poems of the Old West: A Rocky Mountain Anthology. Manchester, NH: Ayer Company Publishers (Facsimile edition, 1951).
Fife, Austin E., and Alta S. Fife. Cowboy and Western Songs: A Comprehensive Anthology. New York: C. N. Potter (1969). 
Griffin, G.W.H. "Do Jog Along" (Sheet music). New York: E.A. Daggett (1856).
Moore, Frank (ed.). Rebel Rhymes and Rhapsodies. New York: George P. Putnam (1864).

English phrases
Self-sustainability