Linux write protected disk

Linux Mint Forums

Forum rules
There are no such things as «stupid» questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.

Write-protected disk

Post by bat_man » Fri Aug 31, 2018 2:25 pm

My 2nd HDD is a Write-protected disk.
What solutions should I use if I always want it to be not write protected so I can change and save files on that drive?

Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.

Re: Write-protected disk

Post by Mute Ant » Sat Sep 01, 2018 4:15 pm

A standard disk drive is quite difficult to set to Write Protect. It involves a password stored on the drive, unlocked by the BIOS before your OS starts. If this is a possibility, the drive came from an old laptop computer for example, you can clear all the data on the drive with a Secure Erase using command hdparm.

If you have no password set on the drive, it’s just a logical problem. Your OS is refusing to write for some software reason.

So, what model drive is it and why do you think it’s write-protected?

all41 Level 18
Posts: 8925 Joined: Tue Dec 31, 2013 9:12 am Location: Computer, Car, Cage

Re: Write-protected disk

Post by all41 » Sat Sep 01, 2018 4:18 pm

This is an example from my system:
sdc 8:32 0 232.9G 0 disk
└─sdc1 8:33 0 232.8G 0 part /media/uno/archival
so the mount point for my secondary drive is /media/uno/archival

Then change the write permissions in a terminal:

Re: Write-protected disk

Post by bat_man » Sat Sep 01, 2018 4:41 pm

The disk is NTFS, from/made in Win10. I cant use it as download Dir: ore delete files in it as the Delete options is not highlighted when I right-click in the menu.

hink@Hink:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 59,6G 0 disk ├─sda1 8:1 0 731M 0 part /boot ├─sda2 8:2 0 1K 0 part └─sda5 8:5 0 58,9G 0 part └─sda5_crypt 253:0 0 58,9G 0 crypt ├─mint--vg-root 253:1 0 51G 0 lvm / └─mint--vg-swap_1 253:2 0 8G 0 lvm [SWAP] sdb 8:16 0 931,5G 0 disk └─sdb1 8:17 0 931,5G 0 part /media/hink/Lokal disk sr0 11:0 1 1024M 0 rom hink@Hink:~$ sudo chmod 700 /media/hink/Lokal disk sudo chmod 700 / media / hink / lokal disk chmod: Unable to access '/ media / hink / Lokal': The file or directory is not available chmod: Unable to access disk: The file or directory does not exist

Re: Write-protected disk

Post by Mute Ant » Sat Sep 01, 2018 5:30 pm

Читайте также:  Удалить гугл хром линукс

That’s not a disk [+] it’s an NTFS volume. Linux will refuse to write to NTFS if there’s anything journaled or hibernated or if the file-system is ‘inconsistent’ (damaged). You have to.
o Use a Windows-based OS to completely shut down the NTFS.
. OR.
o Give up on NTFS and upload-reformat-download to a FLOSS file-system that Linux can repair, like VFAT or EXT4 or BTRFS.

[+]
DRIVE: Hardware thing with wires going to it.
DISK: Spinning hardware thing in a drive.
VOLUME: Reserved space on one or more disks.
FILESYSTEM: Labelled cupboards and shelves in a volume.

catweazel Level 19
Posts: 9763 Joined: Fri Oct 12, 2012 9:44 pm Location: Australian Antarctic Territory

Re: Write-protected disk

Post by catweazel » Sat Sep 01, 2018 6:10 pm

hink@Hink:~$ sudo chmod 700 /media/hink/Lokal disk 

It should be sudo chmod 700 /media/hink/Lokal\ disk

That space in Lokal disk needs to be escaped.

«There is, ultimately, only one truth — cogito, ergo sum — everything else is an assumption.» — Me, my swansong.

Re: Write-protected disk

Post by GS3 » Sat Sep 01, 2018 6:11 pm

Mute Ant wrote: ⤴ Sat Sep 01, 2018 5:30 pm Linux will refuse to write to NTFS if there’s anything journaled or hibernated or if the file-system is ‘inconsistent’ (damaged).

I have also had it happen that I have opened/mounted an NTFS volume/disk with Linux and it would later not start with Windows. Several times I thought the NTFS volume had been corrupted and I reinstalled Windows on the «corrupted» NTFS volume. I later discovered / realized that they had probably not been corrupted but that had not been unmounted by Linux and were marked as «busy» and that is why they would not work. Next time it happened I went back to Linux and made sure to unmount the volume before shutting down Linux.

Due to this type of problem happening so often now I play it safe. Each OS resides on its own HDD and each OS does not access the other’s HDD. They are separate worlds. If and when I want to transfer files between HDD I first copy them to a third storage as go-between, either a USB pendrive or another server on the network. This has saved me much trouble.

Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.

Источник

🛠️ Решение ошибки mount: /dev/sdb is write-protected, mounting read-onlymount: unknown filesystem type ‘(null)’

При подключении виртуального диска я вижу его в выводе, это sdb:

lsblk -f NAME FSTYPE LABEL UUID MOUNTPOINT fd0 sda ├─sda1 ├─sda2 ext4 f0ea8e71-46b3-4b16-be45-882ccaa3e800 /boot └─sda3 LVM2_member URK7Du-7SnV-9See-mSwd-JSVr-B485-U33YEw ├─bootdg-root ext4 01de731b-1d9b-4f44-89c3-6e03e36fc148 / └─bootdg-swap swap 495a84f1-0cfb-40af-bbf3-ec41eac1719f [SWAP] sdb sr0

Теперь логично будет примонтировать его:

mount: /dev/sdb is write-protected, mounting read-only mount: unknown filesystem type '(null)'

Также я попробовал слудующие варианты:

# mount /dev/sdb /media/backup -t auto mount: you must specify the filesystem type
# mount /dev/sdb1 /mydisk/ -t ntfs mount: unknown filesystem type 'ntfs'
# mount /dev/sdb /media/backup -t ext4 mount: wrong fs type, bad option, bad superblock on /dev/sdb, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so.

Решение

mkfs.ext4 /dev/sdb 2>/dev/null /dev/sdb is entire device, not just one partition! Proceed anyway? (y,n)

Далее нажмите y

mkfs.ext4 /dev/sdb 2>/dev/null /dev/sdb is entire device, not just one partition! Proceed anyway? (y,n) y Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 655360 inodes, 2621440 blocks 131072 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2151677952 80 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done

Теперь вы можете спокойно выполнить монтирование диска.

Читайте также:  Линукс консоль на windows

Источник

USB turn write protection off

@micha — what kind of USB device is it — obviously you’ve checked if it has a hardware switch? any errors if you attempt to mount it? sudo mount /dev/sdb1 -v ?

micha, fair enough. Have you tried running efsck or used Ubuntu’s Disk Utility to check the health status of the flash disk? If it was working fine & then stopped working all of a sudden there could be a hardware malfunction.

@kingmilo e2fsck : Bad magic number in super-block while trying to open /dev/sdb1 SuperBlock is not readable.

@micha — very well, still doesn’t mean it’s not faulty though unfortunately. It’s common for storage devices to appear to work normally when in fact they are faulty, just at a different stage of faulty. I think with all the activity on this question you should ask for small donations to replace the drive, it would be easier 😜

8 Answers 8

To turn off disk device`s write protect, we use the low level system utility hdparm like this:

sudo apt-get install hdparm sudo hdparm -r0 /dev/sdb 

where we asume that /dev/sdb is the Physical disk device we’re working on. If the device has partitions that are mounted as read-only, you should re-mount ’em as read-write in order to write data to them.

@OP I had the same as you, which is: sdxc card mounted read-only whatever the computer; hdparm -r shows «1 — on» then after unlocking with r0 : «0 — off» but mount read-only anyway. But mounting my SanDisk sd card in another adapter and I couuld mount it rw. It turns out two of my microSD-to-SD adapters have a broken pin between two connectors. And these two will mount read-only whatever I do. Kuddos to @Angel_Genchev he answer has the most command in it.

Читайте также:  Astra linux версия samba

@lliseil It’s more than likely the reader’s write protect switch is being pressed upon by the card inserted into it, normally by the tab on the card but the switch (not the tab) can become bent and stuck on. you can fix the sdcard reader by cutting off the write-protect switch pins, the ones that make physical contact with the lock tab on the card. When the switch in the reader is open, write-protect is off, when it is closed (by being pressed upon the the tab on the card) write protect is on. Removing one or both of the switches metal arms will permanently disable write-protect on the reader.

After researching your question it appears that this is a not-too-uncommon problem with certain brands of USB flash drives (some older Samsung, a Kingston model) that would essentially just «crap out» for no known reason. People had tried opening them and jumping two leads (maybe from a flaky switch?) to no avail. If you still have this drive and it’s still in warranty I’d return it and get a replacement.

I hate to break the bad news to you =\ but it appears you’re out of luck in this situation as everything I’ve read points to hardware failure.

Edit 05/27/2016: I experienced an issue personally with a flash drive flaking out on me recently. In my case, this was a Corsair Flash Voyager 128GB that started slowing down pretty drastically on me. While it didn’t show the symptoms noted here, it occasionally would not mount and showed up as a «Silicon Power» device. This was a result of the drive having accrued a large amount of bad sectors and dropping into diagnostic/programming mode. Since this is one of my more popular answers and this also falls into the category of «failing flash drives,» I figured I’d include it here for reference.

Update 2: Regarding that Corsair Flash Voyager, I sent mine in for an RMA, only to have my second one fail on me in the same fashion. The problem actually turned out to be mechanical. The sliding mechanism seems to put a small amount of pressure on the PCB. Ordinarily, this wouldn’t have caused an issue in the normal life span of the device. But for this particular model, it seems to have had weak solder joints that the pressure from the sliding action exacerbated — leading to oxidation in the cracked joint and eventual failure. Rather than doing yet another RMA, I took matters into my own hands. I opened the case, shaved some of the plastic casing away to give the PCB some wiggle room and then reflowed the NAND chip to repair the broken solder joints. It’s working great to this day!

Источник

Оцените статью
Adblock
detector