Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Trying to fix a hard drive; prompted need permissions...

  1. #1
    Join Date
    May 2007
    Location
    Mideast US
    Beans
    370
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Question Trying to fix a hard drive; prompted need permissions...

    Good day.
    An external hard drive pluggable to USB for my laptop used only when needed to backup about once a year without any operative system; none, non bootable, and used for a decade as backup for everything is probably corrupted from a clumsy powering off. It is a Seagate Barracuda 7200.7 - 200GByte capacity.

    Following web instructions to diagnose / repair; get prompted that I need permissions.
    There is nobody else using my laptop, I am the owner, I am the only operator.
    Reading about the subject, saw some 'file' permissions. I want permission granted for everything, drives and all their contents not only files, everywhere to attempt repairing and if successful, create a second backup copy for insurance.

    Tried following instructions to obtain full permissions and unable to achieve it. Any idiotproof guidance, please ?

  2. #2
    Join Date
    Jun 2010
    Location
    London, England
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Trying to fix a hard drive; prompted need permissions...

    It would be nice to know what version of Ubuntu you are using and what version of Ubuntu you were using when you used this drive as a backup?

    Does the Disks utility see this drive and show the partition layout? Does the File Manager see this drive and show folders in the partitions? Use File Manager>Permissions to see what the partitions are on the drive and its folders.

    You may need to do some work a root/administrator to change the permissions to allow you to read and write to the drive and its folders and the files in each folder.

    What is it you want to do to "fix" this drive? Copy data off of it and then reformat the drive?

    Regards
    It is a machine. It is more stupid than we are. It will not stop us from doing stupid things.
    Ubuntu user #33,200. Linux user #530,530


  3. #3
    Join Date
    Jun 2014
    Beans
    7,466

    Re: Trying to fix a hard drive; prompted need permissions...

    There is nobody else using my laptop, I am the owner, I am the only operator.
    You are missing a very basic concept of Linux which is that it is a multi-user system by design and Ubuntu and almost all other Linux systems have at least one regular user plus the
    root user. In Ubuntu, root privileges are gained by using sudo.

    You haven't indicated if this drive was used with a Linux system, a windows system or a Mac or any combination. What filesystem is on it? Have you tried doing a filesystem check?

    I want permission granted for everything,
    No, that will likely destroy the system as there are many files which need root owner and permissions. Personal data is another thing.

    Since you haven't posted a link to any site which gave instructions you followed, there is no way for us to know. A bad shutdown will often lead to a corrupt filesystem and if it is Linux, then run some variation with option of the fsck command should help. There are literally thousand of sites explaining fsck and its use and yes, you will need sudo to use it.

  4. #4
    Join Date
    May 2007
    Location
    Mideast US
    Beans
    370
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Trying to fix a hard drive; prompted need permissions...

    Thank you.
    This ill external hard drive has been used only as data backup for over 10 years and only with Ubuntu. Now with 22.04. One single partition. Shows below by the terminal text as sdb1 ???
    The disks utility where that chinese name may had been an early use of a thumb drive. Do not know why shows here as is not plugged in now.

    Screenshot from 2024-05-15 20-26-13.png


    The terminal shows :
    (image attached)

    and the instructions I tried to follow say :

    ================================================== ==============

    How to troubleshoot Seagate Barracuda 7200.7 hard drive issues under Linux?
    To diagnose a Seagate Barracuda 7200.7 with Linux, you can follow these steps:

    Step 1: Identify the drive

    Use the lsblk command to list all the block devices on your system, including the Seagate Barracuda 7200.7. This will help you identify the device name, such as /dev/sdb or /dev/sdc.

    Step 2: Check the drive’s health

    Use the smartctl command to check the drive’s health. This command will provide information about the drive’s temperature, health, and any errors that have occurred.

    smartctl -a /dev/sdb
    Step 3: Check the drive’s partitions

    Use the fdisk command to check the drive’s partitions. This will help you identify if the drive is partitioned correctly and if there are any issues with the partition table.

    fdisk -l /dev/sdb
    Step 4: Check the drive’s file system

    Use the fsck command to check the file system on the drive. This will help you identify if there are any issues with the file system, such as corruption or errors.

    fsck -f /dev/sdb1
    Step 5: Check the drive’s disk usage

    Use the df command to check the drive’s disk usage. This will help you identify if the drive is full or if there are any issues with disk space.

    df -h /dev/sdb1
    Step 6: Check for firmware updates

    Check the Seagate website for firmware updates for your specific drive model. If there are updates available, follow the instructions to update the firmware.

    Step 7: Run a disk scan

    Use the badblocks command to run a disk scan on the drive. This will help you identify if there are any bad sectors or errors on the drive.

    badblocks -v /dev/sdb
    Step 8: Check the drive’s SATA settings

    Check the SATA settings in your BIOS or UEFI firmware to ensure that the drive is set to use the correct mode (AHCI or Legacy). Some users have reported issues with the drive not being recognized when set to AHCI mode.

    By following these steps, you should be able to diagnose any issues with your Seagate Barracuda 7200.7 drive using Linux.

    ================================================== ================

    The terminal text copied and pasted is :

    externet@externet-ThinkPad-T430s:~$ lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
    loop0 7:0 0 4K 1 loop /snap/bare/5
    loop1 7:1 0 169.3M 1 loop /snap/brave/393
    loop2 7:2 0 169.3M 1 loop /snap/brave/402
    loop3 7:3 0 63.9M 1 loop /snap/core20/2182
    loop4 7:4 0 63.9M 1 loop /snap/core20/2264
    loop5 7:5 0 74.2M 1 loop /snap/core22/1122
    loop6 7:6 0 74.2M 1 loop /snap/core22/1380
    loop7 7:7 0 66.1M 1 loop /snap/cups/1044
    loop8 7:8 0 66.1M 1 loop /snap/cups/1047
    loop9 7:9 0 268.2M 1 loop /snap/firefox/4033
    loop10 7:10 0 268.3M 1 loop /snap/firefox/4090
    loop11 7:11 0 7.4M 1 loop /snap/gedit/684
    loop12 7:12 0 349.7M 1 loop /snap/gnome-3-38-2004/143
    loop13 7:13 0 349.7M 1 loop /snap/gnome-3-38-2004/140
    loop14 7:14 0 504.2M 1 loop /snap/gnome-42-2204/172
    loop15 7:15 0 505.1M 1 loop /snap/gnome-42-2204/176
    loop16 7:16 0 81.3M 1 loop /snap/gtk-common-themes/1534
    loop17 7:17 0 91.7M 1 loop /snap/gtk-common-themes/1535
    loop18 7:18 0 112.9M 1 loop /snap/simplenote/620
    loop19 7:19 0 112.9M 1 loop /snap/simplenote/621
    loop20 7:20 0 12.9M 1 loop /snap/snap-store/1113
    loop21 7:21 0 12.3M 1 loop /snap/snap-store/959
    loop22 7:22 0 38.7M 1 loop /snap/snapd/21465
    loop23 7:23 0 39.1M 1 loop /snap/snapd/21184
    loop24 7:24 0 476K 1 loop /snap/snapd-desktop-integration/157
    loop25 7:25 0 452K 1 loop /snap/snapd-desktop-integration/83
    loop26 7:26 0 90.8M 1 loop /snap/whatsapp-for-linux/58
    loop27 7:27 0 90.8M 1 loop /snap/whatsapp-for-linux/59
    sda 8:0 0 29.8G 0 disk
    ├─sda1 8:1 0 1M 0 part
    ├─sda2 8:2 0 513M 0 part /boot/efi
    └─sda3 8:3 0 29.3G 0 part /var/snap/firefox/common/host-hunspell
    /
    sdb 8:16 0 186.3G 0 disk
    └─sdb1 8:17 0 186.3G 0 part
    sr0 11:0 1 1024M 0 rom
    externet@externet-ThinkPad-T430s:~$ smartctl -a /dev/sdb
    Command 'smartctl' not found, but can be installed with:
    sudo apt install smartmontools
    externet@externet-ThinkPad-T430s:~$ sudo apt install smartmontools
    [sudo] password for externet:
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
    libflashrom1 libftdi1-2 libllvm13
    Use 'sudo apt autoremove' to remove them.
    Suggested packages:
    gsmartcontrol smart-notifier mailx | mailutils
    The following NEW packages will be installed:
    smartmontools
    0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
    Need to get 583 kB of archives.
    After this operation, 1,980 kB of additional disk space will be used.
    Get:1 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 smartmontools amd64 7.2-1ubuntu0.1 [583 kB]
    Fetched 583 kB in 0s (1,172 kB/s)
    Selecting previously unselected package smartmontools.
    (Reading database ... 204782 files and directories currently installed.)
    Preparing to unpack .../smartmontools_7.2-1ubuntu0.1_amd64.deb ...
    Unpacking smartmontools (7.2-1ubuntu0.1) ...
    Setting up smartmontools (7.2-1ubuntu0.1) ...
    Created symlink /etc/systemd/system/smartd.service → /lib/systemd/system/smartmo
    ntools.service.
    Created symlink /etc/systemd/system/multi-user.target.wants/smartmontools.servic
    e → /lib/systemd/system/smartmontools.service.
    Processing triggers for man-db (2.10.2-1) ...
    externet@externet-ThinkPad-T430s:~$ smartctl -a /dev/sdb
    smartctl 7.2 2020-12-30 r5155 [x86_64-linux-6.5.0-35-generic] (local build)
    Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

    Smartctl open device: /dev/sdb [USB Sunplus] failed: Permission denied
    externet@externet-ThinkPad-T430s:~$ fsck -f /dev/sdb1
    fsck from util-linux 2.37.2
    e2fsck 1.46.5 (30-Dec-2021)
    fsck.ext2: Permission denied while trying to open /dev/sdb1
    You must have r/w access to the filesystem or be root
    externet@externet-ThinkPad-T430s:~$ badblocks -v /dev/sdb
    badblocks: Permission denied while trying to determine device size
    externet@externet-ThinkPad-T430s:~$ sudo chmod -R 755 /media/ExternalDrive
    chmod: cannot access '/media/ExternalDrive': No such file or directory
    externet@externet-ThinkPad-T430s:~$ sudo chown $USER /media/ExternalDriveName
    chown: cannot access '/media/ExternalDriveName': No such file or directory
    externet@externet-ThinkPad-T430s:~$

    ================================================== ==============
    Attachment 293778
    Attached Images Attached Images
    Last edited by Innernet; 3 Weeks Ago at 03:47 AM.

  5. #5
    Join Date
    Mar 2011
    Beans
    2,020

    Re: Trying to fix a hard drive; prompted need permissions...

    Use sudo on those commands needing permissions: e.g. sudo smartctl -a /dev/sdb
    Most system changes require root permission which is available through sudo for the default user created at installation.

  6. #6
    Join Date
    May 2007
    Location
    Mideast US
    Beans
    370
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Trying to fix a hard drive; prompted need permissions...

    Took almost 2 hours :

    ================================================== ====

    externet@externet-ThinkPad-T430s:~$ sudo badblocks -v /dev/sdb
    [sudo] password for externet:
    Checking blocks 0 to 195360983
    Checking for bad blocks (read-only test): 10104040
    10104041
    10104042
    10104043
    27876832
    27876833
    27876834
    27876835
    done
    Pass completed, 8 bad blocks found. (8/0/0 errors)
    externet@externet-ThinkPad-T430s:~$

    ================================================== =

    What is the next action to repair, or lock them out, or ?

  7. #7
    Join Date
    Mar 2011
    Beans
    2,020

    Re: Trying to fix a hard drive; prompted need permissions...

    See https://askubuntu.com/questions/8579...t-for-the-disk Check the sudo smartctl -a /dev/sdb for reallocated sectors. I suppose you could remake the filesystem and give it the bad block list to skip, then restore from backups. Probably would then need to check places using the UUIDs for mounts (/etc/fstab, /boot/efi/EFI/ubuntu/grub.cfg,....). Also see https://askubuntu.com/questions/8579...t-for-the-disk The e2fsck -fccky /dev/sdbx seems a promising way to add bad blocks to an existing bad block list.

  8. #8
    Join Date
    Jun 2014
    Beans
    7,466

    Re: Trying to fix a hard drive; prompted need permissions...

    sudo chmod -R 755 /media/ExternalDrive
    The above command gave you a message of 'no such file or directory'. Were you using an example from some web site? You need to use the actual mount point so in the case above, there would need to be a directory named 'ExternalDrive' in your /media directory.

    You also need to use sudo for many commands, in particular running fsck or it won't run as you see in your message. Your other tools report there are bad blocks.

  9. #9
    Join Date
    May 2007
    Location
    Mideast US
    Beans
    370
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Trying to fix a hard drive; prompted need permissions...

    Thanks
    ubfan1
    Maybe too much for my poor skills. Seems both of your links are the same. And they are around formatting or after formatted.
    I prefer not to format and lose everything; but attempt something to gain access to the vast majority of not bad blocks to recover at least the data in those good blocks. The hard drive itself is not worth half a penny to me; I have a dozen of other drives to take its place. The thing is accessing the not corrupted data, fixing, recovering it.

    Twenty years ago; at work I used often a program "Spinrite" very capable of fixing/recovering drives but worked on DOS. I have an old version of it but no brain to put it to use on Ubuntu. Is there something similar now ?


    yancek. Yes, now I realize i wrongly used an example from some site, and explains how dumb am I. But do not know what mount point or how to enter or manage commands if that is the path to recover the data for this hard drive that does not show to be active. I do not even know what is a mount point. When I click 'mount' for the sick drive does some clicking and nothing else.
    Last edited by Innernet; 3 Weeks Ago at 02:09 PM.

  10. #10
    Join Date
    Jul 2017
    Beans
    1

    Re: Trying to fix a hard drive; prompted need permissions...

    Hi innernet,
    you might want to look through this post: https://askubuntu.com/questions/8658...drive-recovery
    I used the "Photorec" part myself and it worked like a charme. Lost the filenames but most of the data was back. Good luck

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •