Linux remount read write

How to make read-only file system writable?

At some point, the filesystem on my digital audio player has become read-only. I cannot copy files into it or remove files on it. Are there some possible reasons for the player’s file system to change permissions in this way? I tried using chmod :

$ sudo chmod a+rw SGTL\ MSCN/ chmod: changing permissions of `SGTL MSCN/': Read-only file system 

Could you also add brand of the player? 🙂 searching ‘SGTL MSN’ actually ONLY brings up this topic 😀 If you are really unlucky it’s the device that’s bugged: as a last(!) resort reset the player. But only when you do not get any good anwsers soon(ish) 🙂

Tried everything, and found a simple solution (heretic). Plug the usb to windows 8 or 7, click «repair external drive», go back to linux. Hope this helps someone.

7 Answers 7

If a filesystem has been mounted read-only, chmod will not work since it’s a write operation too.

Try remounting it read-write:

sudo mount -o remount,rw '/media/SGTL MSCN' 

If the device has a write lock on it (like SD memory cards), you need to turn it off. Hardware locks cannot be disabled by software. Note that the write lock on SD memory cards is located from the sight you see the letters near the up left corner and it looks like a very small switch.

Some filesystem drivers may also not support write operations, this is the case with the older NTFS module supported by Linux. For NTFS filesystems, be sure to use the ntfs-3g driver which should be picked automatically nowadays. If not, you can force the driver with something like:

sudo mount -t ntfs-3g -o uid=$(id -u) /dev/sdb1 /mnt/ 

(where /dev/sdb1 has to be substituted for your block device and /mnt/ for your destination)

@XavierStuvw If read/write protected means readonly, ok. Otherwise you could try to wipe it and repurpose it. The wipefs command can be used on a partition to ensure that no filesystem is recognized. See man wipefs (part of util-linux).

@JoshuaSalazar how did you mount it? Perhaps you could create a new question and include such details, this comment section is getting a bit too large.

For NTFS file systems this problem may occur when it is not properly unmounted (probably by unexpected shutdown of windows). In such cases the file systems are marked as locked.

Читайте также:  Linux добавление маршрута по умолчанию

You can mount them properly using the following ntfsfix command, for example:

Please replace /dev/sda3 with your own device name.

I’d like to add for future Googlers that doing this fixed the «New Steam library folder must be on a filesystem mounted with execute permissions» on Manjaro Linux and it’s probably the same for other distros.

Thanks for this! I’m dual booting Kubuntu and Windows 10 and I could not understand why sometimes I’m unable to mount a disk with write permissions!

I had this problem occur on several USB sticks. Each time I searched for an answer and tried various suggestions, including using Terminal to run commands, reformatting on both Linux and Windows machines, etc. All to no avail.

It happened to me again today so again I went looking to see if I could find a solution. I tried the things here, but they didn’t work.

Out of desperation I again went to Disk Utility. I unmounted the drive and then hit «Format» on the partition portion, not the drive portion — USB only had the single partition. This time it WORKED. Then I went to the drive portion and again reformatted the single partition as a master boot drive and monkeyed a bit more with it.

The upshot is, I’m now able to read and write to the drive again.

I don’t know if I just got lucky this time or not. But it is working again.

Источник

How to remount as read-write a specific mount of device?

How to remount as read-write a specific mount of device? (one folder) The file is «Read-only file system», rw-r-r, so it not allow to change permissions. I need to replace that file, then change permissions back to read-only. I know command

mount -o rw,remount [destination folder] 

I know this method is unstable, and may cause complications (every mount will get changed). So I must be sure that this will remount as read-write only a specific destination folder , not every mount of the device. I need do this on running system, not test environment. Embedded linux system. Is that possible? Path to folder: /etc/foo/bar I need remount /bar folder. EDIT:

mount rootfs on / type rootfs (rw) /dev/root on / type squashfs (ro) proc on /proc type proc (rw) ramfs on /var type ramfs (rw) sysfs on /sys type sysfs (rw) tmpfs on /dev type tmpfs (rw) devpts on /dev/pts type devpts (rw) /dev/mtdblock4 on /nvram type jffs2 (rw) 
cat /proc/mounts rootfs / rootfs rw 0 0 /dev/root / squashfs ro 0 0 proc /proc proc rw 0 0 ramfs /var ramfs rw 0 0 sysfs /sys sysfs rw 0 0 tmpfs /dev tmpfs rw 0 0 devpts /dev/pts devpts rw 0 0 /dev/mtdblock4 /nvram jffs2 rw 0 0 
 ls -la total 6 drwxr-xr-x 2 root 0 98 Jan 18 2011 . drwxrwxr-x 7 root 0 105 Feb 10 2011 .. -rw-r--r-- 1 root 0 1052 Jan 18 2011 file1 -rw-r--r-- 1 root 0 270 Jan 18 2011 file2 -rw-r--r-- 1 root 0 1088 Jan 18 2011 file3 -rw-r--r-- 1 root 0 270 Jan 18 2011 file4 mount -o rw,remount /etc/foo/bar mount: can't find /etc/foo/bar in /proc/mounts 

Источник

Читайте также:  Writing windows iso to usb linux

How do I change file system in recovery mode to read-write mode?

I have messed up my sudoers file and I want to change the permission on it. When I login in recovery mode, I cannot run the command chmod as it is read-only option. I tried mount -o remount,rw / in recovery mode. Didn’t work for me:

Err : Ext4-fs remount. Opts errors=remount-ro 

3 Answers 3

I did some web searching on «Recover Mode Read Only» and came across this post on LinuxQuestions.org website.

  1. Shutdown the computer
  2. Boot into Recovery Mode —After BIOS load, hold down Shift key to access the grub menu —Once in grub menu, select the entry ending in «(recovery mode)»
  3. From the next menu selected option to enter Root Session
  4. At the root session, execute command mount -o rw,remount / to remount the filesystem as read-write

@RishabhAgrahari You’ll get that message if you added a space after «rw» in the command (ask me how I know 🙂 ). It’s as-written: mount(space)-o(space)rw,remount(space)/

Since the answer is a bit old and did not work for me, I share with you my solution. I mistyped an option in fstab for the / directory (very bad, I know).

In order to mount in recovery mode with read write option the mentioned solutions did not work for me.

I simply chose the kernel with recovery mode option and pressed e to modify the boot parameter from ro to rw .

I always use following way to change into read/write mode

  • Login in Safe Mode
  • From the Menu just go to Grub option, it will give a message like Updating grub will mount your system in read/write mode. Just chose yes to mount your system in read/write mode. It will update your grub and will exit from Grub menu.
  • Finally login as root, your system will be in read/write mode.
  • You can also chose dpkg option from the menu to change file system to read/write mode.

It always worked for me. It helps when you don’t remember the command to change into read/write mode.

@gman: Safe Mode is kind of login without the GUI part! You can do so by holding Shift while your system restarts. You’ll get a GRUB menu from where you can choose to login in SAFE MODE

You must log in to answer this question.

Highly active question. Earn 10 reputation (not counting the association bonus) in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity.

Читайте также:  Simply linux нет установки

Источник

How to remount filesystem in the read-write mode under Linux

Most of the time on newly created file systems of NFS filesystems we see an error like below :

root@kerneltalks # touch file1 touch: cannot touch ‘file1’: Read-only file system

This is because the file system is mounted as read-only. In such a scenario you have to mount it in read-write mode. Before that, we will see how to check if the file system is mounted in read-only mode and then we will get to how to remount it as a read-write filesystem.

How to check if file system is read only

To confirm file system is mounted in read only mode use below command –

# cat /proc/mounts | grep datastore /dev/xvdf /datastore ext3 ro,seclabel,relatime,data=ordered 0 0

Grep your mount point in cat /proc/mounts and observer third column which shows all options which are used in the mounted file system. Here ro denotes file system is mounted read-only.

You can also get these details using mount -v command

root@kerneltalks # mount -v |grep datastore /dev/xvdf on /datastore type ext3 (ro,relatime,seclabel,data=ordered)

In this output. file system options are listed in braces at last column.

Re-mount file system in read-write mode

To remount file system in read-write mode use below command –

root@kerneltalks # mount -o remount,rw /datastore root@kerneltalks # mount -v |grep datastore /dev/xvdf on /datastore type ext3 (rw,relatime,seclabel,data=ordered)

Observe after re-mounting option ro changed to rw . Now, the file system is mounted as read-write and now you can write files in it.

Note : It is recommended to fsck file system before re mounting it.

You can check file system by running fsck on its volume.

root@kerneltalks # df -h /datastore Filesystem Size Used Avail Use% Mounted on /dev/xvda2 10G 881M 9.2G 9% / root@kerneltalks # fsck /dev/xvdf fsck from util-linux 2.23.2 e2fsck 1.42.9 (28-Dec-2013) /dev/xvdf: clean, 12/655360 files, 79696/2621440 blocks

Sometimes there are some corrections that need to be made on a file system that needs a reboot to make sure there are no processes are accessing the file system.

  • How to safely remove disk from LVM
  • How to add UUID entry in /etc/fstab in Linux
  • How to install EC2 Linux server in AWS with screenshots
  • How to identify current boot disk in HPUX
  • How to forward SSH key in Putty
  • How to enter single user mode in SUSE 12 Linux?
  • Create nice text banner in HPUX
  • How to execute command inside Docker container
  • How to move /tmp on a separate disk as a separate mount point
  • Run command on multiple linux servers from windows
  • How to map Linux disk to vmware disk
  • How to resolve the MFA entity already exists error

Источник

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