- Как исправить read only file system в Linux
- Ошибка read only file system в Linux
- How to mount a hard disk as read-only from the terminal
- 4 Answers 4
- Remount a busy disk to read-only mode
- 2 Answers 2
- rm cannot remove read-only file system – Quick fix
- How we resolve the error ‘rm cannot remove read-only file system’
- Conclusion
- Related posts:
- PREVENT YOUR SERVER FROM CRASHING!
- How to fix «sudo: unable to open . Read-only file system»?
- 19 Answers 19
- Not the answer you’re looking for? Browse other questions tagged filesystem restart read-only or ask your own question.
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
Как исправить read only file system в Linux
Ошибка read only file system может возникнуть при загрузке с LiveCD диска или в режиме восстановления вашего дистрибутива. Она означает, что файловая система в которую вы пытаетесь вести запись примонтирована только для чтения. Этому может быть несколько причин. Есть файловые системы, которые доступны только для чтения это файловая система оптических дисков — ISO, а также файловая система образов SquashFS.
С такими файловыми системами вы сделать ничего не сможете. Для изменения данных в них, надо распаковать образ, изменить данные и запаковать его обратно. Но что касается обычных файловых систем, таких как EXT4, BTRFS, XFS, то их можно монтировать и для чтения и для записи.
Ошибка read only file system в Linux
В этой небольшой статье мы рассмотрим как исправить read only file system Linux перемонтировав файловую систему для записи. Первым делом надо определиться с точкой монтирования, для которой надо разрешить запись. Попытаемся создать файл в корневом каталоге:
Ошибка, файловая система корневого каталога доступна только для чтения. Чтобы посмотреть все точки монтирования доступные в системе выполните в терминале:
mount | grep /dev/sd
В данном случае, корневая файловая система и есть точкой монтирования. Но у вас, например, возникнут проблемы с созданием файла в домашней папке, то надо будет уже перемонтировать /home. Смотрите внимательно. Когда точка монтирования выбрана, осталось её примонтировать с правами на запись:
sudo mount -o remount,rw /
sudo mount -o remount,rw /home
После этого вы сможете создать файл без каких-либо проблем. После завершения работы, во избежание повреждения данных при перезагрузке, желательно перемонтировать файловую систему обратно в режим только для чтения:
sudo mount -o remount,ro /
Теперь вы знаете что означает эта ошибка и как с ею справится. Если у вас остались вопросы, спрашивайте в комментариях!
Источник
How to mount a hard disk as read-only from the terminal
How do you mount a hard disk from the command line as read-only? I don’t want or need a link to the man page, I want the exact thing I will have to type in if the following is true:
- disk to mount is on /dev/sda
- it is 2 TB -it is critical that I mount it read-only and not read-write. Very critical.
- I’m doing it from a live Ubuntu CD so I have no business to edit the fstab or any file for that matter
4 Answers 4
You do not mount /dev/sda , that refers to the entire disk. You mount /dev/sda1 or whatever partition you want.
Make a mount point, call it anything you like.
When your done, you should unmount the disk
When mounting the filesystem read-only, some trouble may happen. The system may try to write into the device anyway and fail.
For that reason the noload flag may be used, to notify to the system that the disk is blocked.
The best solution I found was:
The manual of mount(8) explains this options as follows:
Mount the filesystem read-only. A synonym is -o ro .
Note that, depending on the filesystem type, state and kernel behavior, the system may still write to the device. For example, Ext3 or ext4 will replay its journal if the filesystem is dirty. To prevent this kind of write access, you may want to mount ext3 or ext4 filesystem with ro,noload mount options or set the block device to read-only mode, see command blockdev(8) .
Don’t load the journal on mounting. Note that if the filesystem was not unmounted cleanly, skipping the journal replay will lead to the filesystem containing inconsistencies that can lead to any number of problems.
Источник
Remount a busy disk to read-only mode
I want to force a disk partition to read only mode and keep it read-only for more than 30 minutes.
What I have tried:
mount -o remount,ro (partition-identifier) (mount-point) -t (filesystem)
Issue: This gave device busy error as some processes were using the partition. I don’t want to kill the processes using the disk. I want to simulate the disk suddenly going read-only when the processes are still using it.
Used magic sysrq key, like below
Issue: This will make all the disk partitions read-only (although device is busy). But after 20-30 minutes the machine is rebooting itself. Some machines are rebooting immediately once this command is executed. Not sure what is causing this reboot yet. I don’t want the machine to reboot itself and need to keep the disk in read-only mode for 30+ minutes.
Question: Is there any better way I can force a single disk partition to read-only and sustain it in that state for half an hour and bring it back to read-write mode without causing any reboot in the process?
2 Answers 2
You normally can’t remount a filesystem as read-only if processes have a file on it that’s open for writing, or if it contains a file that’s deleted but still open. Similarly, you can’t unmount a filesystem that has any file open (or similar uses of files such as a process having its current directory there, a running executable, etc.).
You can use umount -l to release the mount point and prevent the opening of further files, but keep the filesystem mounted and keep processes that already have files open running normally.
I can’t think of a generic way to force a filesystem to be remounted read-only when it shouldn’t be. However, if the filesystem is backed by a block device, you can make the block device read-only, e.g.
echo u > /proc/sysrq-trigger is a rather extreme way to force remounting as read-only, because it affects all filesystems. It’s meant as a last-ditch method to leave the filesystem in a clean state just before rebooting.
Remounting a filesystem as read-only does not cause a reboot. Whatever is causing the reboot is not directly related to remounting the partition as read-only. Maybe it’s completely unrelated, or maybe this triggers a bug in the application which causes it to spin and make the processor overheat and your processor is defective or overclocked and eventually reboots. You need to track down the cause of the reboot.
Источник
rm cannot remove read-only file system – Quick fix
Are you looking for a solution to the error ‘rm cannot remove read-only file system’? We can help you with it.
Here at Bobcares, we have seen several such problems when removing a file in Linux as part of our Server Management Services for web hosts and online service providers.
Today we’ll take a look at the fix for this error.
How we resolve the error ‘rm cannot remove read-only file system’
Recently, one of our customers received the below error while removing the backup folder.
This is what the customer gets when he runs mount.
Also, we found that ls -la /media/usbdisk gives the following.
Here the error message clearly says that the filesystem on which omitted is located is read-only. We cannot do anything to modify that filesystem, including removing files.
Let’s see what our Support Engineers suggest to resolve this problem.
First, we check the mount point of the filesystem by running df X. It would be probably /media/usbdisk.
Then we run the below command to remount the filesystem as read-write.
This fixed the problem.
However, if you receive any error for the above command then in some way or someone is attacking your filesystem . You have to umount that partition and perform fsck for that partition.
However, we suggest to find out why those files were set to read-only. This might indicate that you shouldn’t delete them.
Run the below command to see what options were specified when mounting that filesystem.
For an ext2/ext3/ext4 filesystem, if the options did not include ro (read-only) but include errors=remount-ro, then it means the filesystem was damaged and was automatically remounted as read-only to limit the damage. You will find more information in the kernel logs.
Check /var/log/messages and /var/log/syslog for mount events or possible filesystem corruption.
[Need any further assistance with Linux related errors? – We are here to help you.]
Conclusion
In today’s writeup, we saw how our Support Engineers remove files from the read-only file system and resolve the ‘rm cannot remove the read-only file system’ error message.
Related posts:
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
Источник
How to fix «sudo: unable to open . Read-only file system»?
The title might not be as descriptive as I would like it to be but couldn’t come up with a better one.
My server’s file system went into Read-only. And I don’t understand why it does so and how to solve it.
I can SSH into the server and when trying to start apache2 for example I get the following :
When I try restarting the server I get :
Once I restart it manually it just start up without any warning or message saying something is wrong.
I hope somebody could point me into the right direction to resolve this issue.
19 Answers 19
The filesystem will usually go into read-only while the system is running if there is a filesystem consistency issue. This is specified in fstab as errors=remount-ro and will occur when a FS access fails or an emergency read-only remount is requested via Alt + SysRq + U . You can run:
to force a check of all filesystems. As one of the other answers states, looking at dmesg is also very helpful.
Edit: Don’t forget the -M on the command-line.
NOTE: As mentioned by Bibhas in his answer: If fsck gets stuck after its version banner:
you may want to try using the EXT4-specific fsck
Provided the partition in question /dev/sda1 was an ext4 filesystem.
The answer by hexafraction didn’t work for me. Every time I tried executing sudo fsck -Af -M it just showed
and nothing else. No error or anything. For me, booting into a live disc and executing this worked —
Provided the partition in question /dev/sda1 was an ext4 filesystem.
Here is the command that solved my problem :
better than a reboot or sudo fsck -Af
If you want to force your root filesystem to remount as rw, you can do the following.
Try running dmesg | grep «EXT4-fs error» to see if you have any issues related to the filesystem / journaling system itself. I would recommend you to restart your system, then. Also, sudo fsck -Af answer by ObsessiveSSOℲ won’t hurt.
Note that sometimes this can be caused by the computer forgetting the system time — disk check fails because the dates in the journal are in THE FUTURE!
Setting the BIOS time (and checking the BIOS battery) fixed this problem for me, without having to do any disk recovery.
(Deleted previous answer)
Edit: The main problem was on the windows side. After updating my Windows 10, the ‘quick start’ option automatically got enabled. On disabling that option again, and then again re-starting the machine, the problem went away. Windows 10 gave me heavy headache for days 🙁
The ‘quick start’ option can be found in ‘power options’ in the control panel. Disable that. 🙂
If you’re dual booting your machine with Ubuntu and Windows together and this issue occurs,it’s because Windows changes the filesystem,in that case this might do the trick. Try disabling fast startup
Control Panel > Hardware and Sounds > Power Options > (in the left) Choose what closing the lid does > Change settings that are currently unavailable > Untick ‘Turn on fast startup’
Now booting into Ubuntu will solve the issue. Hope this helps!
Usually linux puts your filesystems in read only when errors occur, especially errors with the disk or the filesystem itself, errors like a wrong journal entry for example.
You better check your dmesg for disk related errors.
Google is full of discussion about this and you can pick the ones that is closer to your configuration, but a look at dmesg is usually enough.
If you dual boot ubuntu alongside windows 10 it’s probably windows 10’s fast start-up that’s holding onto your filesystem , it doesnt unmount your hard disks properly. to fix this you need to boot into windows 10
- Start > Power Settings
- click on Additional power setting on the right
- click on choose what thepower buttons do on the left
- clock on change settings that are currently unavailable
- unmark turn on fast-startup
- save changes and then reboot into ubuntu everything will work fine!
For me,Rebooting a system solving this issue
as he mentioned about it.
Remember
as System Administrator rebooting should be the latest Solution
In my case it was down to RAID 1 stabilizing after the initial installation. I have /boot and / on s/w RAID1. Having left the system overnight and rebooted, everything is working fine. Richard
If you were in situations that can not use live disc, e.g. you are remotely ssh into your system, you can still using the command that @Bibhas had answered:
It will prompt for fixing your filesystem error. You also need to reboot your system remotely.
Check if you have any faulty hardware.I got this error due to a hardisk loosening. Ran mount -o remount,rw / and it worked fine.
It looks like some mounted files have got corrupted, and as a result, the kernel has set the file system to RO to prevent further damage. To find which file system is corrupted, we could run:
The output would be similar to the below:
One of the solutions for this issue could be to remount the corrupted file system.
I have had this problem on my computer for over 1 year and tried everything to solve the problem. Suddenly Linux goes into read-only mode. If you are editing something you are unable to save and have to execute fsck command and reset the computer. The computer is also very slow and freezing all the time. I removed the dual boot and left only Ubuntu, upgraded Ubuntu from version 18.04 LTS to version 20.04 LTS, and it didn’t work. What was crucial to solving the problem is the use of the dmesg command. The experience didn’t work out for me, just this command. The function of this command is to monitor the computer.
In my case, the problem was related to the SSD incompatibility with Ubuntu. I used HDD and after I switched to SSD the problem came up. The problem was solved by updating the SSD firmware, which was only possible by partitioned Windowns, because Kingston does not have the program to update firmware through Linux. I also installed the dual boot Windowns and Linux, first installing Windows over the entire SSD, then deallocating space through Windowns and installing Ubuntu, but it is very unlikely that this was the solution to the problem.
If you have the graphical user interface go to the disk application, select the drive with the issue, click on the gears icon and choose the option Repair Filesystem. In less than a second the problem is fixed.
It’s misconfigured boot settings (try mounting / as ext2 ) not drive or partition physical error.
dmesg | grep «error» gave me:
It mounted / as read only due to the fstab error=mount-ro directive.
I am using the 18.04 LTS release and what I did was, first I unmounted my damaged drives then I went into “Disks” app by seaching in the dash. From there I selected the drive which was damaged. Make sure it is unmounted else it won’t work. In the options menu (the little gear shape), and clicked on “repair file system”. Boom! Worked like a charm.
Not the answer you’re looking for? Browse other questions tagged filesystem restart read-only or ask your own question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.10.8.40416
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Источник