r/debian • • 4d ago

Help!

I can't open one of disks on my PC, I don't know what to do. I'm not sure what could have done this. Last time I turned on PC everything was fine. Do you think the fact that PC went without electricity for nearly 24 hours? I wasn't able tot turn it off properly because of my UPS no longer working properly.

Update: I managed to copy all my data to a different disk. Problem was caused by one .odt file that was saved incorrectly due emergency incorrect shutdown of PC (thanks to my broken UPS).

19 Upvotes

31 comments sorted by

View all comments

1

u/CardOk755 4d ago

Do you have a filesystem on /dev/sda2. What type of filesystem? Is it broken?

What does the dmesg log say?

0

u/maria08042009 4d ago

I don't know... I am a really casual user, so I have no idea

1

u/CardOk755 4d ago

Mods removed your dmesg, don't know why, but:

Aha, you have a Microsoft NTFS filesystem on /dev/sda2 and it was uncleanly unmounted.

Historically Linux has been really bad at fixing problems on NTFS filesystems. I'd recommend trying to mount that disk on a windows system.

(I might be out of date, I haven't messed with NTFS in years).

1

u/maria08042009 4d ago

how should I do that? it's not a disk I can just take out of PC (it's inside the PC, basicaly tome D, but not exactly). and my PC is fully Debian. should I try virtualbox Windows (how t odo that too...)?

1

u/CardOk755 4d ago

Ow. Looks like you got rid of Windows too soon. You should have copied all the data you wanted to save to somewhere safe first.

Just how much important data is on that partition?

1

u/maria08042009 4d ago

It's mostly pictures and few kinda personal docs, so it'd be really sad to lose them, but nothing that would cause long-trem damage, I think.

1

u/maria08042009 4d ago

And I had just Debian system from last February, and hadn't had any problems like this... Probably it's connected with the fact that my UPS stopped working (I live in Ukraine, situation with electricity is not pretty. I didn't have electricity from 7am Oct. 9 to 6:40 am Oct. 10).

1

u/CardOk755 4d ago

Oh, it's certainly due to the unclean shutdown.

If you can't use Windows then try ntfsprogs, https://manpages.debian.org/trixie/ntfs-3g/ntfsprogs.8.en.html

ntfsls to list the files in the partition and ntfscat to copy them from the partition to a Linux partition.

When you are sure you have all the data you want you can reformat the partition for Linux.

2

u/maria08042009 4d ago

Thanks! I think it can wait a till Monday-Tuesday, because I should have a working UPS by then (I really don't want to risk it, situation with electricity is very unstable).

1

u/CardOk755 4d ago

By the way, all the ntfsxxx programs (like ntfsls and ntfscat) from ntfsprogs are part of the ntfs-3g package, which I think you have installed.

1

u/KlePu 4d ago

Removing a drive from a PC is not hard at all. Obviously unplug power/remove battery first ;)

Tower PC: get a screwdriver, remove two screws on the rear left to remove the left panel. Then google your disk to see what it looks like; "normal" SSDs are about the size or a pack of cigarettes, NVMe are way smaller, like your thumb but flat.

Laptop: depends on model, but there's video guides for pretty much every model nowadays.

Then, get a USB enclosure for a few bucks and see a friend who runs Windows ;)

2

u/maria08042009 3d ago

Thanks, that's probably going to be last resort, but useful to know nevertheless.

1

u/KlePu 3d ago edited 3d ago

Whatever you do, try to use read-only mode when accessing the troubled disk until you got a clean copy of all the data. If you do have a disk with enough free space, you could try to create a 1:1 copy and only work on that. dd can copy block data directly, you can then redirect that data to a file:

  • find a place that has enough space: df -h to get /path/to/place/with/space/ (this is a read only command, cannot do any harm)
  • check the path of your NTFS disk: lsblk -f to get /dev/sdX (this is read only as well)
  • then create the actual image: sudo dd if=/dev/sdX of="/path/to/place/with/space/my-data.img" bs=4M conv=noerror,sync status=progress && sync (this can destroy all of your data if used incorrectly ;-p)

edit: mixed up my variables, sorry <.<

If you do want to try this, I can give more detailed instructions ;)

2

u/CardOk755 3d ago

df only works on mounted filesystems.

1

u/KlePu 3d ago

Yep, mixed up the outputs. Corrected ;)

1

u/maria08042009 4d ago

Is it possible to copy files from this disk beforehand?

1

u/CardOk755 4d ago

From that partition? You could look into the ntfsprogs package, that might let you list and copy files from the partition.

I have no idea whether it's safe. I'm nowhere near an expert on NTFS.

Personally, I'd use Windows to fix it then copy all the important files off to a Linux partition.

What important data dies it contain?

1

u/FarToe1 4d ago

This is a chance to learn something as you fix it.

If you don't want to, then time to buy another pc.

(It could be a loose lead, weak power supply, or bad drive)