Linux fstab read only
После удаления (физически) диска из компьютера, в fstab осталась запись о точке монтирования и это приводит к ошибке (см.рис.):
*** An error occurred during the file system check.
*** Dropping you to a shell; the system will reboot
*** when you leave the shell.
Причем, на мой взгляд вывод абсолютно не информативен, т.к. информации о партиции которая вызвала ошибку, на экране как раз нет. Я даже не сразу догадался в чем дело, только понял что ошибка произошла на этапе проверки файловых систем. На рисунке видно что три из них проверку прошли, а вот четвёртая здесь не показана, она то и вызвала ошибку. Но об этом нужно догадаться самому, как-будто разработчикам было трудно сделать вывод, что-нибудь типа: «Точка монтирования ХХХ не найдена…»
Короче, предлагается ввести пароль root-а, чтобы получить консоль. Если нажать Control-D — сервер перезагрузиться и опять получим туже самую ошибку.
Ввожу пароль. Получаю консоль, но перед # — стоит надпись (Repair filesystem). Причем, корневая файловая система смонтирована только для чтения read-only (не следует обращать внимания что mount выводит на экран rw, далее warning всё объясняет).
Нужно перемонтировать файловую систему с полным доступом. Мне помогла команда:
mount -no remount,rw /
Можно тоже сделать по другому:
mount -w -o remount /
После этого нужно отредактировать файл /etc/fstab (через vi или nano) — нужно убрать или закомментировать строку о неверной точке монтирования.
Источник
Как исправить 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 /
Теперь вы знаете что означает эта ошибка и как с ею справится. Если у вас остались вопросы, спрашивайте в комментариях!
Источник
Disk mounted as read-only, but defined as read-write in fstab
I’m having an issue with my computer; I recently installed Deepin Linux, based on Debian, and I’d like to use my internal ntfs formatted HDD on it.
I made an fstab entry to auto-mount it at startup, here is the line:
The problem is that in the defaults options, the disk is supposed to be mounted as rw , but it’s still in read only mode.
Does anyone has an idea to help me?
EDIT:
I did what jpgaugh said, but it still doesn’t work; here is my new fstab line:
2 Answers 2
Okay, I finally found how to make it work.
The problem was because of Windows 10, which left some Windows cache data on the partition. To solve it, I booted on windows, I disabled the fast start option and I restarted to Linux, and now it’s okay.
Here is my working fstab line:
Also know that with windows 10 you have to be careful because the default shutdown puts the ntfs disks to sleep or hibernation rather than the traditional state of being flushed & unmounted or whatever it’s called; this will either cause problems for other operating systems mounting that ntfs disk or when windows 10 goes to access it again after someone else has accessed it when it was hibernated by win10, then win10 will often think it is dirty and do a disk check.
Windows 10 — control panel — power options — System Settings or Choose what the Power Buttons do — uncheck Turn on fast startup (recommended)
turn off fast startup
for a better technical answer of what is happening, a web search on windows 10 disk fast startup would explain. I had numerous windows 10 problems and linux mount problems going back & forth with win10 on one disk and linux on another disk where linux uses ntfs-3g to access my ntfs disks. Also, they say the win10 fast startup does not affect restart it only affects shutdown
Источник
Repairing fstab (read only /)
I had a typo in my fstab and it boots to a commandline but is readonly, I know what the error is but i can’t change it because it’s mounted as readonly. I want to mount the filesystem and make the changes. I know I can boot a live distro and edit it that way, but i was wondering if there was an easier way to do it.
It’s debian lenny by the way.
6 Answers 6
Yes, if you end up in single-user mode with a readonly root, try:
Maybe a -n is necessary, maybe not. That should remount the root fs read/write (assuming there’s nothing wrong with it).
I know that question is outdated, but saw it, because nowadays got in the same trouble. I broke my fstab manually (make a typo in parameter).
That was very easy to correct fstab from readonly mode. We must mount / in read-write mode.
If /etc/fstab is correct, you can simply type:
But if /etc/fstab is wrong (as it was in my case), you must give the device name and possibly the type, too: e.g.
Where extX is your filesystem type and /dev/hdaX — is partition you use for your root mount point.
To see all your available partitions just type ls /dev/[sh]d* .
if /dev/sda1 is the real device, then do:
@troyane saved my hassle by providing
I was on Orangepi3 EMMC when I had a typo in UUID of root having ext4 filesystem.
The command remounted in read-write mode and I fixed my fstab
My kernel command line looks like this:
Tell grub that it should omit passing «ro» to the kernel when booting (pressing esc , e on the entry you want edit will allow you to edit the arguments given to the kernel), and it will mount your root file system not read only anymore. Then you can change your /etc/fstab and restart.
If you have something wrong with your /etc/fstab file. Please follow the following steps.
- boot your ubuntu system or restart your computer
- since you can not start your system, you will encounter some errors like
“a start job is running for dev-disk-by. (you may need pressing F2 key to come the linux command terminal to see this)
- use command vi /etc/fstab and edit your fstab file
- use # to commend out some problems and add something you want put in the fstab file.
- finish editing. hit shift+z and save the modification
- use command reboot to restart your system
- it works again
Источник
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.
Источник