Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Possible to re-install Debian 8.7 without destroying data?

Ask for help with issues regarding the Installations of the Debian O/S.
Post Reply
Message
Author
RagnarRainMaker
Posts: 1
Joined: 2017-03-24 09:21

Possible to re-install Debian 8.7 without destroying data?

#1 Post by RagnarRainMaker »

Hi all,

I was pulling my 5th all nighter in an 8 day period last week. Either I was feeling slappy, careless or just sleepy, but I ran 'sudo apt-get remove -y <some important packages>' and well... I'm sure you can see where this is going ;-) More than a few "important" packages like python and a few others were removed.

After putting on my dunce cap, and sitting in the corner for 30 minutes, I was able to re-install many of them, but I keep getting errors regarding a missing python package named 'lsb-release' and 'apt-pkg' (or something like them at any rate).

As far as options go, it seems I've reached the end of the rope. So I created a bootable USB drive with Debian 8.7 (Jessie) and ran the installer. I was hoping I could re-install the base Debian system without overwriting or destroying my root partition, because that's where I keep all my data, and well... I kind of like my data. In the Debian installer screen where I select the root partition to install to, the command to advance to the next stage in the installer was something like "write changes to the partition table", which seem just a bit destructive to me.

So after that long, and hopefully good for a laugh, pre-amble here's my question. Is it possible to re-install the Debian base system while keeping the existing partition, and data in /home/username, in tact without destroying it?

I realize I can always backup my data and then re-partition the disk. I'm just hoping that isn't necessary. Mainly because I have a lot of data and it'll take a long time to copy to my trusty USB drive.

Anyone have any ideas?

User avatar
Thorny
Posts: 542
Joined: 2011-02-27 13:40

Re: Possible to re-install Debian 8.7 without destroying dat

#2 Post by Thorny »

RagnarRainMaker wrote:I realize I can always backup my data and then re-partition the disk. I'm just hoping that isn't necessary. Mainly because I have a lot of data and it'll take a long time to copy to my trusty USB drive.
Backing up is always necessary if you have data that you want to keep. It may take some time but once you have it backed up you only have to keep the backup current and likely most of your data doesn't change often. When you have data that is only on running hardware it is always at risk. If not from mistakes such as you have explained here then from hardware that might fail at any time.

This has been the best practice advice for as long as I can remember and it would have been easier and faster to get your system up and working. It would still be a safety factor while you try the chroot.

You wouldn't even have had to ask the question in this post if you had a valid backup that you could restore easily. Do yourself a favour over the long run and figure out a backup strategy that works for your use case.

peer
Posts: 443
Joined: 2017-03-26 10:14
Has thanked: 8 times
Been thanked: 20 times

Re: Possible to re-install Debian 8.7 without destroying dat

#3 Post by peer »

you can reinstall debian without destroying your data
During the install proces you can choose to manual select the partitions for installing debian.
Choose for manual install. For each partition you can then choose to format it (or not format it).

But this will keep your normal data but also the hidden files. (you can delete these hidden files with a rescue disk before reinstalling if you want).
I think this will work but is not a solid solution. You are better of when you make a backup of your data and perform a clean install.

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Possible to re-install Debian 8.7 without destroying dat

#4 Post by dasein »

At the risk of seeming to "pile on," I'm going to echo and amplify what Thorny has already mentioned.

"It is possible to reinstall without backing up" is simply the wrong question. It's like asking "Is it possible to drive around with no spare tire?"

The answer to both questions is the same: Even if it were "possible," there's no earthly reason to want to do it in the first place. Failures happen, sometimes in critical systems, and you have two choices: be prepared for them when (not if) they occur or suffer the consequences.

Putting critical data (think: /home) on its own partition is a well-known and well-documented way to make backup and recovery easier. If you'd taken that simple precaution in the first place, you'd be "home free" right now, able to restore or reinstall the OS without affecting your personal data. But you chose not to do that. Ooops.

Regular and redundant backups is the only way to preserve data against all sort of problems--not just PEBKAC, but lightning strikes, flooding, mechanical failure, etc. But you chose not to do that, either.

And now you're asking for help in perpetuating your mistakes. Really? :roll:

In other words, this backup you're trying so hard to avoid is actually the only sane and sensible path available to you. And you're complaining that it will take time?? Pardon me, but WFW

The true "take away":

Step 1: Back up your data. If you're frustrated by the time it takes, remind yourself of how long it would take to recreate all your data; you'll realize in an instant that, temporally speaking, backups are the best bargain of all time.

Step 2: Reinstall, but this time, put /home on a separate partition. That way, the next time you type sudo do-something-really-stupid, you can restore/reinstall the OS without risking data you care about. Added bonus: you won't have to spend 2 paragraphs tap-dancing around about how you were tired, or distracted, or sexually frustrated, or whatever.

- Step 3: Repeat step 1 on a regular basis. Use multiple media, and rotate your backups. It's what the pros do, and there's a reason they do it that way.

tl;dr: Your problem isn't a lack of sleep, it's a chronic lack of insight and forethought.

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: Possible to re-install Debian 8.7 without destroying dat

#5 Post by stevepusser »

The installers for certain Debian derivative distros will allow one to save the contents of /home, even if it's on the same partition as root, but then you won't be running "True Debian". But backup anyway.
MX Linux packager and developer

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1400
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 79 times
Been thanked: 175 times

Re: Possible to re-install Debian 8.7 without destroying dat

#6 Post by steve_v »

Of course it's possible, assuming the data you want to keep is intact.
Just reinstall and restore your backup. You do back up your important data, right?

If you don't have a backup...
* Boot the livecd / install media, mount your existing partition and back up your stuff to another disk.
* Reinstall. Consider putting /home on a separate partition so you can avoid step 1 in future.
* Set up a proper backup, to another machine and / or external device. Ideally back up critical data to an off-site location. There are a plethora of options, I use good old rsync.

You got off pretty light this time, sooner or later you will have a disk die suddenly, or fat-finger rm -rf. Make regular backups, and test them.
Not so long ago, I had a 10TB RAID array fail (3 disks died in ~8hrs). Restoring from backups was a pain. But if i had no backup it would have been a total loss.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Post Reply