Ed Sheeran has met and performed for Queen Elizabeth II, but he was once homeless and sleeping outside of Buckingham Palace.

The 'Thinking Out Loud' crooner shared the gritty -- but inspirational -- details of his days as a struggling musician in his book, 'A Visual Journey,' excerpted in the Daily Mail.

The redheaded singer-songwriter revealed that after he finished a program at a London college in 2007, he couldn't afford to pay rent and managed to scrape by playing small shows, occasionally couch surfing and sleeping on the subway.

"I didn’t have anywhere to live for much of 2008 and the whole of 2009 and 2010, but somehow I made it work," he explained. "I knew where I could get a bed at a certain time of night and I knew who I could call at any time to get a floor to sleep on. Being sociable helped. Drinking helped."

While Sheeran explained that he would often sleep on the tube ("I’d go out and play a gig, wait until 5am when the Underground opened, sleep on the Circle Line until 12, go to a session – and then repeat"), there were a few instances where he crashed near the Queen's residence.

"There was an arch outside Buckingham Palace that has a heating duct and I spent a couple of nights there," Sheeran revealed. "That’s where I wrote the song 'Homeless' and the lines 'It’s not a homeless night for me, I’m just home less than I’d like to be.'"

"I didn’t have the best personal hygiene at that point because I didn’t get a chance to shower," he added. "It was just: sleep on the train, session, sweat on stage, drink, sleep on the train. I had 23 dreads on one side of my head from not washing my hair. My girlfriend counted them when she took them out with a comb."

Now, Ed Sheeran is so wildly successful (and busy!) in his career that he finds himself wanting to take some time off before he comes out with his next album in 2016.

“I haven’t had any time off since before I signed my record deal and I want some! I’ll do what I enjoy and it won’t feel like work," he told the Sun (quote via Sugarscape), sadly breaking hearts with the news that he also won't have a Christmas single out this year.

“(The Christmas song) won’t be out this Christmas. I have 'Thinking Out Loud' as a single going into Christmas," he said, adding: "If I saw an artist have a string of hits, an album that did well, a hit going into Christmas and then they did a Christmas single I’d think, ‘Ooh, that’s overkill.'"

Not from you, Ed Sheeran, not from you.

See Ed Sheeran + More Celebs' Wildest Tattoos

More From 92 Moose