Linux cannot create directory read only file system

Read-only file system in Ubuntu

My computer has 4 partition. Beside of Ubuntu partitions, I have a partition to save working projects on same disk. I use gnome-disks to auto-mount this partition when startup. However, when I create folder for create file. I got messages like: mkdir: cannot create directory ‘e’: Read-only file system . I’m new to Linux, so if you want to know more abou my system, leave command line and I’ll show you. Thanks for any helps and so sorry about my poor English

It is definitely mounted as read only. Mount output should help us identifying why is your partition read-only.

2 Answers 2

Thanks for your comments, I fixed it.

I install Window beside Ubuntu, Fast Startup of Window make disk not unmount. However, when I switch to Ubuntu, driver NTFS see that disk’s mounting, so it mount read-only.

So I run ntfsfix (additionally, turn of fast startup on Window) and it worked.

I had a similar issue after I cloned a disk and created new virtual machine on openstack Ubuntu.

Steps to resolve: 1.cat /etc/fstab

/etc/fstab: static file system information.

Use ‘blkid’ to print the universally unique identifier for a device. This may be used with UUID= as a more robust way to name devices that works even if disks are added and removed. See fstab(5).

/ was on /dev/ubuntu-vg/ubuntu-lv during curtin installation /dev/disk/by-id/dm-uuid-LVM-do30PLgpOVFMSMdAM4yk61c90yuy3biE4jAn171mXyGByntK0sddMxpZRL1WLPmq / ext4 defaults 0 0 /boot was on /dev/vda2 during curtin installation /dev/disk/by-uuid/1b94eedc-be13-45b6-b7c1-f9892b69296e /boot ext4 defaults 0 0 /swap.img none swap sw 0 0

fsck from util-linux 2.34 e2fsck 1.45.5 (07-Jan-2020) /dev/mapper/ubuntu—vg-ubuntu—lv contains a file system with errors, check forced. Pass 1: Checking inodes, blocks, and sizes Deleted inode 400138 has zero dtime. Fix? yes Inodes that were part of a corrupted orphan linked list found. Fix? yes Inode 400139 was part of the orphaned inode list. FIXED. Inode 400140 was part of the orphaned inode list. FIXED. Inode 400141 was part of the orphaned inode list. FIXED. Inode 400142 was part of the orphaned inode list. FIXED. Inode 400333 was part of the orphaned inode list. FIXED. Inode 420207 was part of the orphaned inode list. FIXED. Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information Block bitmap differences: -(397395—397407) -3850237 -(3852815—3852822) Fix? yes Free blocks count wrong for group #12 (15295, counted=15308). Fix? yes Free blocks count wrong for group #117 (5588, counted=5597). Fix? yes Free blocks count wrong (1462405, counted=1462427). Fix? yes Inode bitmap differences: -(400138—400142) -400333 -420207 Fix? yes Free inodes count wrong for group #48 (0, counted=6). Fix? yes Free inodes count wrong for group #51 (27, counted=28). Fix? yes Free inodes count wrong (935590, counted=935597). Fix (‘a’ enables ‘yes’ to all) ? yes

Читайте также:  Установить google chrome linux mint

/dev/mapper/ubuntu—vg-ubuntu—lv: ***** FILE SYSTEM WAS MODIFIED ***** /dev/mapper/ubuntu—vg-ubuntu—lv: ***** REBOOT SYSTEM ***** /dev/mapper/ubuntu—vg-ubuntu—lv: 309587/1245184 files (0.2% non-contiguous), 3517285/4979712 blocks

After this the read only file system error has gone away. Looks good thereafter.

Источник

Как исправить 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 перемонтировав файловую систему для записи. Первым делом надо определиться с точкой монтирования, для которой надо разрешить запись. Попытаемся создать файл в корневом каталоге:

Ошибка, файловая система корневого каталога доступна только для чтения. Чтобы посмотреть все точки монтирования доступные в системе выполните в терминале:

В данном случае, корневая файловая система и есть точкой монтирования. Но у вас, например, возникнут проблемы с созданием файла в домашней папке, то надо будет уже перемонтировать /home. Смотрите внимательно. Когда точка монтирования выбрана, осталось её примонтировать с правами на запись:

sudo mount -o remount,rw /home

После этого вы сможете создать файл без каких-либо проблем. После завершения работы, во избежание повреждения данных при перезагрузке, желательно перемонтировать файловую систему обратно в режим только для чтения:

Теперь вы знаете что означает эта ошибка и как с ею справится. Если у вас остались вопросы, спрашивайте в комментариях!

Обнаружили ошибку в тексте? Сообщите мне об этом. Выделите текст с ошибкой и нажмите Ctrl+Enter.

Источник

Read Only File System Linux

I have a seperate SATA drive on a CentOS 7 system that I use to keep backups.

Recently, when I try to create or copy files to the mounted drive, I get and error saying
the file system is read only.

For example, if I try to create a new folder, I get » mkdir: cannot create directory test’: Read-only file system»

Any idea how I can troubleshoot and fix this? Thanks

This person is a Verified Professional

kajun989

PC Pharm Limited is an IT service provider.

Enter to win a Stack Overflow T-Shirt AND $100 Amazon GC

Contest ends 2023-07-21 Contests Complete the steps to receive a t-shirt! Tell your IT Hero story, and you could also receive a $100 Amazon GC Contest Details View all contests

Читайте также:  Управление скоростью вращения вентиляторов linux

Author Moeen Chowdhary

This person is a Verified Professional

Moeen

There may have been a problem with Fsck of this file system on previous boot. I would do the following:

1.) backup contents of this drive to a removable disk
2.) check /etc/fstab to make sure mount options and fs type are correct (is it set for rw access)
3.) unmount the drive and run Fsck on it with Fsck -y /dev/device. (pay attention to results here to see any problems)
4.) after filesystem is fsck-ed mount it again and see if you can write to it now

Also, it may be the underlying disk going bad, check this link for instructions on how SMART disk monitoring works in Linux:

Hope this helps you find the problem.
-Moeen

7 Replies

This person is a Verified Professional

eric ross

You could try remounting the mounted drive (substitute correct mount directory)

mount -o remount,rw /mountdir

In addition to Eric’s comment, you could run the mount command to see the what mount options are currently in place. If you see «ro», that is the problem.

$ mount devtmpfs on /dev type devtmpfs (rw,relatime,size=3008544k,nr_inodes=752136,mode=755) tmpfs on /dev/shm type tmpfs (rw,relatime) tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755) devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000) /dev/sda2 on / type ext4 (rw,relatime,data=ordered)

Author Moeen Chowdhary

This person is a Verified Professional

Moeen

There may have been a problem with Fsck of this file system on previous boot. I would do the following:

1.) backup contents of this drive to a removable disk
2.) check /etc/fstab to make sure mount options and fs type are correct (is it set for rw access)
3.) unmount the drive and run Fsck on it with Fsck -y /dev/device. (pay attention to results here to see any problems)
4.) after filesystem is fsck-ed mount it again and see if you can write to it now

Also, it may be the underlying disk going bad, check this link for instructions on how SMART disk monitoring works in Linux:

Hope this helps you find the problem.
-Moeen

Author Merlin Yoda

This person is a Verified Professional

MerlinYoda

mount -o remount,rw /mountdir

Huh, I always though you needed to specify the device prior to the directory when doing a remount. I didn’t realize it was optional. You learn something new every day.

Author Brian McKee

This person is a Verified Professional

furicle

/dev/mapper/vg_floppyd-lv_root on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0") /dev/sdb1 on /boot type ext4 (rw) /dev/mapper/vg_floppyd-lv_home on /home type ext4 (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

The (rw) indicates they are currently mounted read-write.
If you have a partition that is mounted read only when you think it should be read-write, you’ll want to explore why. I’d start by looking at the log when that file system is mounted.
If it mounts on boot up, try something like ‘dmesg | grep test’ or just run dmesg and peruse the whole thing. If it mounts when you connect it, just watch /var/log/messages as you connect it. Often it means there is some sort of disk issue that’s been detected, and it’s mounted it read only to prevent you from making it worse. For instance, an NTFS partition that’s marked as ‘dirty’ (needs a disk check on reboot) will mount read only in Linux. The right solution here depends on the file system involved and the message you see when you connect it.

mount -o remount,rw /mountdir

Huh, I always though you needed to specify the device prior to the directory when doing a remount. I didn’t realize it was optional. You learn something new every day.
That’s what I like about these forums—something new every day. 🙂 From the «mount» man page:

When mounting a filesystem mentioned in fstab or mtab, it suffices to give only the device, or only the mount point.

This person is a Verified Professional

OP kajun989

Читайте также:  Install docker for linux

Update, the disk failed Smart tests. A restart of the server caused the disk to be rw again. Disk was replaced

This topic has been locked by an administrator and is no longer open for commenting.

To continue this discussion, please ask a new question.

Источник

Read-only file system error while accessing the files on Ubuntu

LIKE WINDOWS, REBOOTING the machine solved this error. Can someone explain this behaviour to me. I am bit surprised.

This question is impossible to answer sensibly without knowing what file system it is about you’re trying to create your testFolder on. Consider that also NTFS partitions can be accessed from a Linux-type system.

1 Answer 1

A filesystem goes into read-only mode when it has consistency issues. It is a way to prevent possible data corruption. Your next would be to take a backup of all important data from this drive since this could also mean that the hard-drive could be on its way out.

When you rebooted the machine, the / partition got mounted back in the regular rw mode from the read-only it had gone to before rebooting.

You must run an fsck on the / partition to check for any inconsistancy. Since it is the root partition, I believe you will have to get into rescue mode to run the fsck.

You must log in to answer this question.

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.14.43533

Linux is a registered trademark of Linus Torvalds. UNIX is a registered trademark of The Open Group.
This site is not affiliated with Linus Torvalds or The Open Group in any way.

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

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