LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 01-31-2009, 10:44 AM   #1
s_federici
LQ Newbie
 
Registered: Jan 2009
Posts: 3

Rep: Reputation: 0
Read-only filesystem error


After a system crash, my centOS server has been rebooted. Now I would like to copy several files but, whatever cp I try on those same files I could regularly copy before the crash, I keep getting an error message saying

cp: cannot create regular file `xxx': Read-only file system

How can I get rid of this error and be able again of creating copies of my files?

Thanks for your help
 
Old 01-31-2009, 11:29 AM   #2
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 206Reputation: 206Reputation: 206
It looks like whatever you're trying to write to has been mounted as read-only. You'll need to umount it, and mount it again without readonly set. You may also want to run an fsck on your filesystem, check your /etc/stab, reboot, etc.
 
Old 01-31-2009, 02:38 PM   #3
amoralejo
LQ Newbie
 
Registered: Jan 2009
Posts: 9

Rep: Reputation: 1
Try to umount and mount it again in read write. However, note that Linux mount filesystems in read only automatically in some cases, as in example after i/o errors while accessing to the disks.
 
Old 02-01-2009, 03:19 AM   #4
s_federici
LQ Newbie
 
Registered: Jan 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks for your suggestions. I'm ready to unmount and remount it but, being a real linux newbie, I need step-by-step instructions on how to do that. Would you be so kind to send me the exact sequence of commands that will allow me to unmount and remount my filesystem in read/write? Thanks in advance.
 
Old 02-01-2009, 06:03 AM   #5
amoralejo
LQ Newbie
 
Registered: Jan 2009
Posts: 9

Rep: Reputation: 1
By default, local filesystems are mounted in rw mode, so you only have to umount and mount it with default options.

1. Find out the mountpoint. Let's think I receive the error in directory /data/dir1. I execute:

df /data/dir1

You'll find something like:

/dev/something 937372 494028 443344 53% /data

2. Check filesystem is in fstab file:

grep data /etc/fstab

There should be a line for /data, like:

/dev/something /data ext3 defaults

3. Umount it:

umount /data

If there are process running on the filesystem you may get a device busy message. If so, you have to stop the applications that are using ig.

4. Mount it again:

mount /data

and try to write on it again.
 
Old 02-02-2009, 12:57 AM   #6
s_federici
LQ Newbie
 
Registered: Jan 2009
Posts: 3

Original Poster
Rep: Reputation: 0
I followed (I hope) your instructions and here it is what I got. Unfortunately, I'm still unable to cp. I hope I did something wrong!

Quote:
Originally Posted by amoralejo View Post
1. Find out the mountpoint. Let's think I receive the error in directory /data/dir1. I execute:

df /data/dir1

You'll find something like:

/dev/something 937372 494028 443344 53% /data
[root@host11-230-149-62 downloads]# df /home/admin7714990/downloads/
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 149128000 28188636 113241824 20% /

Quote:
Originally Posted by amoralejo View Post
2. Check filesystem is in fstab file:

grep data /etc/fstab

There should be a line for /data, like:

/dev/something /data ext3 defaults
[root@host11-230-149-62 downloads]# grep / /etc/fstab
/dev/sda1 / ext3 defaults 1 1
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
/dev/sda2 swap swap defaults 0 0

Quote:
Originally Posted by amoralejo View Post
3. Umount it:

umount /data

If there are process running on the filesystem you may get a device busy message. If so, you have to stop the applications that are using ig.

4. Mount it again:

mount /data

and try to write on it again.
[root@host11-230-149-62 downloads]# umount /
[root@host11-230-149-62 downloads]# mount /
mount: /dev/sda1 already mounted or / busy
mount: according to mtab, /dev/sda1 is already mounted on /

Thenn, when I tried to cp I get the usual error:

[root@host11-230-149-62 downloads]# cp linx-2.1.0.tar linx-2.1.0.1.tar
cp: cannot create regular file `linx-2.1.0.1.tar': Read-only file system
 
Old 02-03-2009, 02:03 PM   #7
amoralejo
LQ Newbie
 
Registered: Jan 2009
Posts: 9

Rep: Reputation: 1
Unfortunately you are trying to write to the root filesystem (/) that can not be unmounted, I'm afraid you have to reboot your server. It's a bit strange to have / in read only, a lot of other process should be failing, have you notice more problems?, try to write something in /tmp or /var in example.

By the way, it's a good practise to create different partitions and not to use only one for /.

Regards,

Alfredo
 
Old 09-13-2010, 10:30 PM   #8
student04
Member
 
Registered: Jan 2004
Location: Georgia
Distribution: OS X, CentOS
Posts: 669

Rep: Reputation: 34
Quote:
Originally Posted by amoralejo View Post
Unfortunately you are trying to write to the root filesystem (/) that can not be unmounted, I'm afraid you have to reboot your server. It's a bit strange to have / in read only, a lot of other process should be failing, have you notice more problems?, try to write something in /tmp or /var in example.

By the way, it's a good practise to create different partitions and not to use only one for /.

Regards,

Alfredo
I know this thread is old (1.5+ years) but I wanted to add a correction to this, as I found it on the first google result list searching for "error copying, read only filesystem". You can remount your filesystem without unmounting and mounting.

Code:
# mount -o remount,rw /
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I have: Root has Read-Write, user has read only for the boot filesystem? xmrkite Linux - Software 6 10-16-2008 04:31 AM
Raid disk problem : Attempt to read block from filesystem resulted in short read ElmPie Linux - General 5 08-26-2008 05:21 AM
error mounting ext3 filesystem... mount: /dev/hdd1: can't read superblock versaulis Linux - Software 5 11-26-2006 08:34 PM
my linux error : Couldn't open /dev/null (read-only filesystem) Darick Ang Linux - General 3 10-28-2003 01:27 PM


All times are GMT -5. The time now is 01:20 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration