Skip to main content
added 548 characters in body
Source Link
Garo
  • 2.2k
  • 12
  • 16
  1. Shutdown your system.
  2. Boot from a USB-stick (or any other live medium) with a Linux distro
  3. After booting install tools for messing around with btrfs. (I am assuming your usb-stick is also a ubuntu): sudo apt install btrfs-progs on Ubuntu 20 or sudo apt install btrfs-tools on older systems. (It will be installed in memory)
  4. Install tools to mess around with the disk at hardware level: sudo apt install smartmontools
  5. Mount your disk read-only: mkdir /mnt/baddisk && mount -o ro /dev/sdb1 /mnt/baddisk (sdb1 will probably be different in your case)
  6. Backup your data: rsync -Havz /mnt/baddisk someothersystem:/dataofbuggydisk/

Only now you can play around.

  • Use smartctl -a /dev/sdb to see if reallocation is actually still a option. Reallocation will be handled low level by your disk itself, not by btrfs.
    If the disk can't do this you will certainly not be able to do this.
  • You can play around with btrfs rescue and btrfs check if needed. But if you only have a couple of bad sectors this will probably not be needed. A regular Ubuntu config makes sure that the filesystem is always in the best condition possible.
    Normally the only thing you should worry about is what SMART tells you about this disk. Use smartctl to check it from to time. (It could be that nowadays Ubuntu also does this for you and warns you when necessary but I'm not sure about this, also do it manually just to be safe.)

Edit: I just noticed that you mentioned that Ubuntu placed your disk in read-only mode. When it decides to do this you have real problems. This can usually only happen when:

  • The system was shutdown uncleanly, but you don't mention it so it's probably not the case
  • You have low-level (disk, not filesystem) problems.

I would strongly advice not to use this disk again. In theory it's certainly possible to recover the filesystem and continue using this disk for a while, but you will end up with large problems sooner or later...

  1. Shutdown your system.
  2. Boot from a USB-stick (or any other live medium) with a Linux distro
  3. After booting install tools for messing around with btrfs. (I am assuming your usb-stick is also a ubuntu): sudo apt install btrfs-progs on Ubuntu 20 or sudo apt install btrfs-tools on older systems. (It will be installed in memory)
  4. Install tools to mess around with the disk at hardware level: sudo apt install smartmontools
  5. Mount your disk read-only: mkdir /mnt/baddisk && mount -o ro /dev/sdb1 /mnt/baddisk (sdb1 will probably be different in your case)
  6. Backup your data: rsync -Havz /mnt/baddisk someothersystem:/dataofbuggydisk/

Only now you can play around.

  • Use smartctl -a /dev/sdb to see if reallocation is actually still a option. Reallocation will be handled low level by your disk itself, not by btrfs.
    If the disk can't do this you will certainly not be able to do this.
  • You can play around with btrfs rescue and btrfs check if needed. But if you only have a couple of bad sectors this will probably not be needed. A regular Ubuntu config makes sure that the filesystem is always in the best condition possible.
    Normally the only thing you should worry about is what SMART tells you about this disk. Use smartctl to check it from to time. (It could be that nowadays Ubuntu also does this for you and warns you when necessary but I'm not sure about this, also do it manually just to be safe.)
  1. Shutdown your system.
  2. Boot from a USB-stick (or any other live medium) with a Linux distro
  3. After booting install tools for messing around with btrfs. (I am assuming your usb-stick is also a ubuntu): sudo apt install btrfs-progs on Ubuntu 20 or sudo apt install btrfs-tools on older systems. (It will be installed in memory)
  4. Install tools to mess around with the disk at hardware level: sudo apt install smartmontools
  5. Mount your disk read-only: mkdir /mnt/baddisk && mount -o ro /dev/sdb1 /mnt/baddisk (sdb1 will probably be different in your case)
  6. Backup your data: rsync -Havz /mnt/baddisk someothersystem:/dataofbuggydisk/

Only now you can play around.

  • Use smartctl -a /dev/sdb to see if reallocation is actually still a option. Reallocation will be handled low level by your disk itself, not by btrfs.
    If the disk can't do this you will certainly not be able to do this.
  • You can play around with btrfs rescue and btrfs check if needed. But if you only have a couple of bad sectors this will probably not be needed. A regular Ubuntu config makes sure that the filesystem is always in the best condition possible.
    Normally the only thing you should worry about is what SMART tells you about this disk. Use smartctl to check it from to time. (It could be that nowadays Ubuntu also does this for you and warns you when necessary but I'm not sure about this, also do it manually just to be safe.)

Edit: I just noticed that you mentioned that Ubuntu placed your disk in read-only mode. When it decides to do this you have real problems. This can usually only happen when:

  • The system was shutdown uncleanly, but you don't mention it so it's probably not the case
  • You have low-level (disk, not filesystem) problems.

I would strongly advice not to use this disk again. In theory it's certainly possible to recover the filesystem and continue using this disk for a while, but you will end up with large problems sooner or later...

Source Link
Garo
  • 2.2k
  • 12
  • 16

  1. Shutdown your system.
  2. Boot from a USB-stick (or any other live medium) with a Linux distro
  3. After booting install tools for messing around with btrfs. (I am assuming your usb-stick is also a ubuntu): sudo apt install btrfs-progs on Ubuntu 20 or sudo apt install btrfs-tools on older systems. (It will be installed in memory)
  4. Install tools to mess around with the disk at hardware level: sudo apt install smartmontools
  5. Mount your disk read-only: mkdir /mnt/baddisk && mount -o ro /dev/sdb1 /mnt/baddisk (sdb1 will probably be different in your case)
  6. Backup your data: rsync -Havz /mnt/baddisk someothersystem:/dataofbuggydisk/

Only now you can play around.

  • Use smartctl -a /dev/sdb to see if reallocation is actually still a option. Reallocation will be handled low level by your disk itself, not by btrfs.
    If the disk can't do this you will certainly not be able to do this.
  • You can play around with btrfs rescue and btrfs check if needed. But if you only have a couple of bad sectors this will probably not be needed. A regular Ubuntu config makes sure that the filesystem is always in the best condition possible.
    Normally the only thing you should worry about is what SMART tells you about this disk. Use smartctl to check it from to time. (It could be that nowadays Ubuntu also does this for you and warns you when necessary but I'm not sure about this, also do it manually just to be safe.)