Bash: Cannot Create Temp File for Here-document: Read-only File System

Dear All,

I accept a seperate SATA drive on a CentOS 7 arrangement that I utilise to go on backups.

Recently, when I try to create or re-create files to the mounted bulldoze, I become and error saying
the file system is read only.

For example, if I attempt to create a new folder, I get " mkdir: cannot create directory test': Read-just file arrangement"

Whatever idea how I tin troubleshoot and fix this? Thanks


Moeen
Moeen This person is a Verified Professional
This person is a verified professional.
Verify your account to enable It peers to see that y'all are a professional.
Jan fourteen, 2022 at 15:46 UTC
There may have been a problem with Fsck of this file organisation on previous kick. I would practise the following:

one.) backup contents of this bulldoze to a removable deejay
2.) bank check /etc/fstab to make certain mountain options and fs type are correct (is it set for rw admission)
3.) unmount the drive and run Fsck on it with Fsck -y /dev/device. (pay attention to results here to see any bug)
4.) after filesystem is fsck-ed mount it once again and meet if you lot 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:

https://www.google.com/amp/s/www.cyberciti.biz/tips/linux-find-out-if-harddisk-declining.html/amp

Hope this helps you lot notice the trouble.
-Moeen

Popular Topics in General Linux
Which of the following retains the information it'southward storing when the system power is turned off?
  • ROM
  • CPU
  • RAM
  • GPU
88% of Information technology pros got this correct.

7 Replies

eric ross
eric ross This person is a Verified Professional
This person is a verified professional.
Verify your account to enable It peers to see that you are a professional.
Jan xiv, 2022 at 15:31 UTC

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

                              mountain -o remount,rw /mountdir                            
pigdog

In addition to Eric's comment, you could run the mountain command to meet the what mount options are currently in place.  If you lot run across "ro", that is the problem.

                            $ mount devtmpfs on /dev type devtmpfs (rw,relatime,size=3008544k,nr_inodes=752136,fashion=755) tmpfs on /dev/shm type tmpfs (rw,relatime) tmpfs on /run blazon 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)                          
Moeen
Moeen This person is a Verified Professional
This person is a verified professional.
Verify your business relationship to enable It peers to meet that y'all are a professional.
Jan fourteen, 2022 at 15:46 UTC
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 bulldoze to a removable disk
ii.) check /etc/fstab to brand sure mount options and fs type are correct (is information technology prepare for rw access)
3.) unmount the drive and run Fsck on it with Fsck -y /dev/device. (pay attending to results hither to see any problems)
4.) subsequently filesystem is fsck-ed mount it once again and see if you can write to it now

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

https://world wide web.google.com/amp/due south/world wide web.cyberciti.biz/tips/linux-find-out-if-harddisk-failing.html/amp

Hope this helps you find the problem.
-Moeen

MerlinYoda
MerlinYoda This person is a Verified Professional
This person is a verified professional.
Verify your account to enable It peers to see that you are a professional.
January 14, 2022 at 15:54 UTC

eric ross wrote:

You could endeavour remounting the mounted drive (substitute correct mountain directory)

                                mountain -o remount,rw /mountdir                              

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

furicle
furicle This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Jan 14, 2022 at xvi:07 UTC

Beginning by running the 'mount' command - It volition give you lot output like this

                              /dev/mapper/vg_floppyd-lv_root on / blazon ext4 (rw) proc on /proc blazon proc (rw) sysfs on /sys blazon sysfs (rw) devpts on /dev/pts type devpts (rw,gid=v,mode=620) tmpfs on /dev/shm blazon tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0") /dev/sdb1 on /kick type ext4 (rw) /dev/mapper/vg_floppyd-lv_home on /dwelling 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 accept a sectionalisation that is mounted read only when you think it should exist read-write, yous'll want to explore why.  I'd start by looking at the log when that file system is mounted.

If information technology mounts on kick up, try something like 'dmesg | grep exam'  or just run dmesg and peruse the whole affair.

If it mounts when you connect it, just sentry /var/log/messages as you connect it.

Often information technology means there is some sort of disk issue that's been detected, and information technology's mounted it read only to forbid you from making it worse.  For instance, an NTFS partitioning that's marked as 'dirty' (needs a disk cheque on reboot) will mount read simply in Linux.   The right solution here depends on the file system involved and the message you see when yous connect information technology.

pigdog

MerlinYoda wrote:

eric ross wrote:

Y'all could endeavour remounting the mounted drive (substitute correct mount directory)

                                mountain -o remount,rw /mountdir                              

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

That's what I like about these forums--something new every day.  :-)

From the "mount" man folio:

                            When mounting a filesystem mentioned in fstab or mtab, it suffices to requite only the device, or merely the mount point.                          
kajun989
kajun989 This person is a Verified Professional
This person is a verified professional person.
Verify your account to enable IT peers to come across that you are a professional.
Jan 23, 2022 at 17:37 UTC

PC Pharm Limited is an IT service provider.

Update, the disk failed Smart tests. A restart of the server acquired the disk to be rw once 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.

kunzeounins.blogspot.com

Source: https://community.spiceworks.com/topic/2186377-read-only-file-system-linux

0 Response to "Bash: Cannot Create Temp File for Here-document: Read-only File System"

إرسال تعليق

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel