TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

How to Automatically Backup a Linux VPS to a Separate Cloud Storage Service

164 点作者 jakejarvis将近 6 年前

23 条评论

joshstrange将近 6 年前
Forgive me if I&#x27;m missing something but this appears to just backup files so it would be fine for source code (should be in version control and safe already) and static assets (like user uploads) but doesn&#x27;t appear to address things like DB backups which I feel like is the number 1 thing lost if you lose access to your host (followed by user uploads). The problem with DB backups is you can&#x27;t just backup the data directory (like &#x2F;var&#x2F;lib&#x2F;mysql) unless you&#x27;ve shutdown the DB or you can do a dump (mysqldump) but backing that up hourly is not a good solution IMHO. I guess you could have a replica that you shut down at the top of the hour, backup the data directory, then start back up but all if this is to say this post is not a silver bullet to &quot;Automatically backup a Linux VPS&quot;.<p>This is NOT a knock against the author, I just wanted to point out that &quot;backups&quot; are much more complicated than &quot;copy files elsewhere&quot;. For DB&#x27;s I&#x27;d probably consider running a replica on 1 or more other clouds. IDK the logistics of replication over the internet but I know for work we do replication from our datacenter down to our local servers and that&#x27;s over a relatively slow connection so I assume it&#x27;s possible to do it from cloud-to-cloud.
评论 #20148410 未加载
评论 #20148855 未加载
评论 #20149318 未加载
评论 #20148449 未加载
评论 #20154244 未加载
turrini将近 6 年前
Vultr AND Linode.<p>1) Upload a custom ISO with ZFS (<a href="https:&#x2F;&#x2F;github.com&#x2F;beren12&#x2F;zfs-iso&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;beren12&#x2F;zfs-iso&#x2F;</a>)<p>2) Create a new VPS without OS and boot to your uploaded ISO.<p>3) Create a ZFS root pool and bootstrap your Debian or another distribution.<p>4) Enable all cool features: compression, encryption, etc.<p>5) rsync your zfs snapshots from Vultr to Linode and vice-versa.<p>This is how I do. You can even use them as templates for newly VPS.<p>And for backups, BackBlaze B2 and WASABI with a zfs-snapshot-upload script.
评论 #20154280 未加载
fabian2k将近 6 年前
I&#x27;ve used rclone for a very similar purpose. Restic, which is used in this post looks very interesting as well.<p>It&#x27;s not the topic of the post, but database backups deserve a special mention. You can&#x27;t just naively copy the database folder this way in most cases, you have to make sure to backup a consistent snapshot of the database. This is still not hard to do at smaller scales, when you can just add an exported dump of the database to your regular backup. But it is a point that needs some attention if you host the database yourself.
评论 #20147439 未加载
评论 #20148888 未加载
评论 #20147107 未加载
评论 #20147512 未加载
krn将近 6 年前
Are there any reasons to prefer Restic over BorgBackup[1]?<p>A conclusion from one comparison (2017)[2]:<p>&quot;Restic’s memory requirements makes it unsuitable for backing up a small VPS with limited RAM, and the slow backup verification process makes it impractical on larger servers. But if you are backing up desktop or laptop computers then this may not matter so much, and using Restic means that you don’t have to setup your own storage server.&quot;<p>Is this still true?<p>[1] <a href="https:&#x2F;&#x2F;www.borgbackup.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.borgbackup.org&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;stickleback.dk&#x2F;borg-or-restic&#x2F;" rel="nofollow">https:&#x2F;&#x2F;stickleback.dk&#x2F;borg-or-restic&#x2F;</a>
评论 #20147459 未加载
评论 #20148618 未加载
Neil44将近 6 年前
I use Duplicity in a similar way to back my Linode stuff up to Backblaze. It does versioning really well and it&#x27;s been very reliable. I&#x27;d still have to configure up a new server somewhere etc but at least I have the data. <a href="http:&#x2F;&#x2F;duplicity.nongnu.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;duplicity.nongnu.org&#x2F;</a>
评论 #20147609 未加载
评论 #20152907 未加载
评论 #20154302 未加载
PStamatiou将近 6 年前
Related - I&#x27;ve been thinking about how to best backup my S3 buckets (some with 50k+ files) off of Amazon. Sure I can setup another bucket with that cross region duplication feature, and I have versioning.. but would really prefer a backup off of Amazon (ie not sending manually created zips in a lightsail&#x2F;ec2 or something to glacier) in case it ever gets hacked or I accidentally nuke the buckets or something like that.<p>Currently just doing a combination of s3cmd for a local archive (takes forever to download and then it doesnt seem like incremental syncs are any faster), as well as having Google Console clone my bucket there (but I&#x27;m not sure if it&#x27;s versioned, or as easy as downloading the whole archive).<p>Never used duplicity -- would it be fast for something like this? Guessing I should just cron it on a remote server instead of running off a local machine frequently.
评论 #20148157 未加载
tickthokk将近 6 年前
Thanks for sharing! While the victims were being scorned by the internet for not having proper backups, nobody was sharing how to achieve that.
评论 #20148204 未加载
z3t4将近 6 年前
Don&#x27;t forget about practicing restoration (catastrophe scenarios). So that you will know how long time it will take to restore, and if something is missing. Last time I did it I did not remember the password for the encryption key. Sure I had it written down on a piece of paper, but the scenario was that the building had burnt down.
评论 #20154315 未加载
smnrchrds将近 6 年前
In a dockerized single-VPS environment, where should cronjobs live? Should they be part of the main Docker container that had the app code, or a separate container that only has all cronjobs, or simply on the host?
评论 #20147273 未加载
评论 #20147763 未加载
评论 #20147869 未加载
kijin将近 6 年前
Meh, just another backup solution that requires AWS keys, ssh keys, etc. to be kept on the same server where your data is. What if that server is compromised? The attacker now has all the keys he needs to delete or modify your backups, too.<p>For maximum peace of mind, always <i>pull</i> backups from a separate server that is not exposed to the world. Don&#x27;t let your primary server <i>push</i> arbitrary data to the backup store.<p>This rule is trickier to follow when your backup store can&#x27;t run scripts, which is why so many tools designed to work with S3 tell you to keep the keys exposed. But if you really want to, you can use an intermediate host to pull backups before pushing them again to S3.
评论 #20148233 未加载
评论 #20148043 未加载
评论 #20148091 未加载
LinuxBender将近 6 年前
My own personal preference is to simply make VM&#x27;s on each VPS that has some storage space, then enable chroot sftp and rsnapshot. Then on the client side, I used LFTP (sftp mirror sub-system) which is compatible with chroot sftp and behaves like rsync.<p>Each VPS backs up to the other. RSnapshot makes daily diffs that use hardlinks to avoid taking up space. This also mitigates tampering, as only root have access to the snapshots.<p>Demo site using anon login for testing: [1]<p>[1] - <a href="https:&#x2F;&#x2F;tinyvpn.org&#x2F;sftp&#x2F;#lftp" rel="nofollow">https:&#x2F;&#x2F;tinyvpn.org&#x2F;sftp&#x2F;#lftp</a>
cure将近 6 年前
+1 for restic. I use it, and it&#x27;s awesome.
评论 #20147020 未加载
heinrichhartman将近 6 年前
Does anyone here have experience with backing up ZFS pools in cloud storage like S3, B2, ...?<p>I have a bunch of snapshots (<a href="https:&#x2F;&#x2F;github.com&#x2F;jakelee8&#x2F;zfs-auto-snapshot" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jakelee8&#x2F;zfs-auto-snapshot</a>) that I want to backup along with the active tree. But don&#x27;t want to keep extra copies of the data.<p>- Do these services offer snapshotting? ...that can be automated?<p>- Is there zfs integration, e.g `zpool send | b2 receive`?
评论 #20147385 未加载
评论 #20147346 未加载
Blackstone4将近 6 年前
One idea I had was to create a service with preconfigured images setup for personal use with VPN, email server and file sync&#x2F;backup. It could be sold to privacy conscious individuals and could compete with ProtonMail.<p>The technical side could be hidden from less technical users and it sold as isolated servers so the data would be protected.<p>I don’t have the skills or the time to work on this so happy for others to use the idea
monkeydust将近 6 年前
I am looking for something that can backup Dropbox, Google Drive and Amazon Cloud to a 3rd party service. What do people recommend?
评论 #20149354 未加载
评论 #20148782 未加载
a2tech将近 6 年前
Does anyone have a recommendation for a backup client that handles millions of tiny files? I&#x27;m using rsnapshot right now, which works but backing up to an NFS share is incredibly slow (most of the time is spent in iterating over the filesystem to get a list of changed files, then running the hardlink process from the previous snapshot).
评论 #20147061 未加载
评论 #20147024 未加载
评论 #20147841 未加载
评论 #20147724 未加载
评论 #20147205 未加载
pnutjam将近 6 年前
Good directions, everyone should do this.
themodelplumber将近 6 年前
I actually like using CPanel&#x27;s built-in backup settings on servers where I have CPanel installed. Amazingly simple to set up, really intuitive, and supports a variety of services. I have used Amazon and SFTP backups so far and they both work really well.
electriclove将近 6 年前
Or use a paid service that handles files and databases for ~$30&#x2F;year like <a href="https:&#x2F;&#x2F;www.dropmysite.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.dropmysite.com&#x2F;</a><p>(I&#x27;m just a customer that has been generally pleased over the past many years)
SkyLinx将近 6 年前
I&#x27;m surprised that no one has mentioned Duplicacy yet. It&#x27;s another very solid, reliable and fast alternative. At the moment I use Restic on servers but use Duplicacy on the desktop. It can also be used on servers of course.
OJFord将近 6 年前
Restic looks neat. I&#x27;ve been looking at using duplicity [0] for similar purposes recently, which does a similar job.<p>Just found a good comparison&#x2F;benchmark of the two at [1] - tl;dr seems to be that restic is fast, and duplicity is small.<p>[0] - <a href="http:&#x2F;&#x2F;duplicity.nongnu.org" rel="nofollow">http:&#x2F;&#x2F;duplicity.nongnu.org</a><p>[1] - <a href="https:&#x2F;&#x2F;github.com&#x2F;gilbertchen&#x2F;benchmarking" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;gilbertchen&#x2F;benchmarking</a>
评论 #20154338 未加载
ausjke将近 6 年前
trying to backup linode image using dd, which works but not easy, I hope VPS vendors can provide a way for customer to migrate when the time comes.
评论 #20147177 未加载
anderspitman将近 6 年前
TLDR for comments: use rclone and&#x2F;or restic