Creating Time Machine Backups Using a Drive That's Way Less Than Twice the Size of My Dataset
8 April 2024 | 11:59 am

Context

I have an external drive. It’s a 4 terabyte drive, and I’m about to use it for backups.

I also have an external SSD. It’s also a 4 terabyte drive, and I have filled 500 gigabytes of it with random stuff that I can afford to lose (which I have excluded from backups). I also took 100 gigabytes of it and created another partition for file transfers, so it’ll be excluded from backups. That means the external SSD uses 3.4 terabytes at maximum.

I also have a MacBook, and the internal storage space for it is 500 gigabytes. I took 100 gigabytes and dedicated it to an Asahi Linux install, which I won’t backup either, so that’s about 400 gigabytes maximum on my MacBook.

So in total, that’s about 3.8 terabytes. And I’m about to create a backup onto a 4 terabyte.

Now, here’s a snippet from the Apple help page for backing up your Mac with Time Machine:

Use a storage device with at least twice the storage capacity of your Mac.

“twice the storage capacity of your Mac” would also include my external SSD, because I include that in backups (after learning the hard way). Given my “[maximum] storage capacity” is 3.8 terabytes, my backup drive would have to be at least 7.6 terabytes. However, 4 terabytes is barely bigger than 3.8 terabytes, and there is a long way left before 7.6 terabytes is reached.

However, I can’t get a hard drive that’s 8 terabytes (close to but more than 7.6 terabytes). Mainly because I couldn’t find any.

So how do you make backups onto a drive that’s barely big enough?

The problem

Recently (very much not), I had to wipe my backup drive again, because Time Machine decided to break again (Time Machine as usual).

I wipe the drive, set it up for backups, and start the backup. All good, right?

Wrong. It doesn’t work. Time Machine has run out of space to create backups.

So I started from square 0, wiping the drive again and attempting another full backup. Nope, same issue.

I thought 3.8 terabytes would fit into 4 terabytes. I guess not. Also, it’s not 3.8 terabytes, it’s more like 3.5 terabytes of actual data. But that should fit into 4 terabytes as well, right?

It should, but for some reason, it doesn’t.

So of course, the only obvious next step was to make it somehow work.

The solution

Time Machine backups can exclude entire volumes, or specific folders.

I already use that feature to exclude stuff that I can easily afford to lose.

However, what if I (ab)used that to create a smaller backup?

So here’s what I did:

  1. Exclude my external SSD
  2. Create the first backup
  3. Exclude a large chunk of my external SSD, but also include a small/medium chunk of it
  4. Create another backup
  5. Include my entire external SSD (except for the losable stuff)
  6. Create the last backup in the process

So the size of the data backed up grows and grows until it is complete. Gradually increasing the size of stuff that is backed up.

Compared to “wipe the drive and create a backup from scratch”, that was basically “backup literally everything at once lol”, and for some reason that doesn’t work well.

I’m not sure why this works, or why Time Machine has troubles creating an initial backup onto a drive with very little space left. Maybe it needs twice the space temporarily for the first few backups? I’m not sure.

The numbers and some math

The actual used space I’ve used on my MacBook and external SSD combined is 3.5 terabytes, which is 0.3 terabytes less than 3.8 terabytes.

My 4 terabytes backup drive would be about 1.142857143 bigger than 3.5. That number isn’t 2 and is much less than 2, so that means the backup drive is not twice as big my data.

(4 terabytes) / (3.5 terabytes) ≈ 1.142857143

:3
1 April 2024 | 8:46 pm

:3


Confusing Shell Quotes
25 February 2024 | 12:15 am

A command

Here’s a command. It will be run in the bash shell. What do you think this command will output?

for i in wh"y is" this a" thin'"''; do echo $i; done

All you have to worry about is how wh"y is" this a" thin'"'' will be split up by the shell. The rest of the command is just print each thing onto a new line, and what’s considered “another argument” is up to the shell.

If you just got absolutely confused, don’t worry, here’s the output:

why is
this
a thin'

And here’s what the command looks like with syntax highlighting:

for i in wh"y is" this a" thin'"''; do echo $i; done

Confusion 100

Here’s another command. What will this output?

echo \
''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""\
""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''\
''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""\
""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''\
''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""\
""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''\
''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""\
""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''\
''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""\
""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''\
''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""\
""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''\
''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""\
""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''\
''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""\
""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''\
''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""\
""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''\
''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""\
""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''\
''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""\
""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''\
''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""\
""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''\
''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""\
""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''\
''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""\
""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''""''

Well it’s actually just the same as running echo. It’ll give you an empty line.

That’s because every quote here and new line as well has been reduced to nothing. There actually no contents in any of those quotes.

More realistic example: Literal apostrophe within a quote using apostrophes

Those were just some ridiculous examples. Here’s some more realistic examples that you may or may not need someday.

Let’s say you’re using single quotes to quote, and then you have to use a single quote within a single quote. Here’s what it would look like for the sentence “Woody’s wood”:

echo 'Woody'\''s wood'

Here’s the purpose of every apostrophe character in order:

  1. Start quoting stuff (So far: echo ')
  2. After the text “Woody”, the quote is closed, returning back to the usual shell interpretation. (So far: echo 'Woody')
  3. An escaped apostrophe for you know, an apostrophe. (So far: echo 'Woody'\')
  4. Start quoting stuff again. (So far: echo 'Woody'\'')
  5. After the text “s wood”, the quote is closed. (So far: echo 'Woody'\''s wood')

So the apostrophe quoting is closed, returning back to the shell interpretation of stuff, then an escaped apostrophe is used, and then the apostrophe quoting returns.

A more reasonable solution would be to use double quotes, but there are cases where you just have to use single quotes (apostrophes) because double quotes won’t work.



More News from this Feed See Full Web Site