cp: cannot create regular file: Read-only file system

40,449

The partition on the card is mounted read-only ro:

/dev/sdc1 on /media/valeriy/TERMINAL type vfat (ro,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

You can unmount it and mount it again, this time with read-write rw permissions. The following link answering another AskUbuntu question may help with details.

Mount NTFS partition in a USB drive with custom permissions and owner

Share:
40,449

Related videos on Youtube

Valentyn Hruzytskyi
Author by

Valentyn Hruzytskyi

Updated on September 18, 2022

Comments

  • Valentyn Hruzytskyi
    Valentyn Hruzytskyi over 1 year

    I have an bootable flash-card (with acronis (not my installation)), I may read but cannot copy file into it. When I uses windows, then I not have any problem, but I cannot use this card in ubuntu - have error Read-only file system

    ~ $sudo cp -f vbinst.sh /media/valeriy/TERMINAL/
    [sudo] password for valeriy: 
    cp: cannot create regular file '/media/valeriy/TERMINAL/vbinst.sh': Read-only file system
    
    $ sudo fdisk -l
    
    Disk /dev/sda: 931,5 GiB, 1000204886016 bytes, 1953525168 sectors
    Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical):
    512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096
    bytes Disklabel type: gpt Disk identifier:
    9F6D513D-4906-4670-9DF3-57280CEF2E8B
    
    Device         Start       End   Sectors  Size Type
    /dev/sda1       2048   3905535   3903488  1,9G Linux swap
    /dev/sda2    3905536 199217151 195311616 93,1G Linux filesystem
    /dev/sda3  199217152 394528767 195311616 93,1G Linux filesystem
    
    Disk /dev/sdb: 119,2 GiB, 128035676160 bytes, 250069680 sectors Units:
    sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512
    bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disklabel type: gpt Disk identifier:
    278B77A6-1ACA-45F8-8C6A-13727B72BA6F
    
    Device         Start       End   Sectors   Size  Type
    /dev/sdb1       2048    739327    737280   360M  EFI System
    /dev/sdb2     739328   1001471    262144   128M  Microsoft reserved
    /dev/sdb3    1001472 246554623 245553152 117,1G  Microsoft basic data
    /dev/sdb4  246554624 250058751   3504128   1,7G  Windows recovery environment
    
    
    **Disk /dev/sdc: 14,6 GiB,** 15676211200 bytes, 30617600 sectors Units:
    sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512
    bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos Disk identifier: 0x018ae7e6
    
    Device     Boot    Start      End  Sectors  Size Id Type
    /dev/sdc1             63 30617599 30617537 14,6G  c W95 FAT32 (LBA)
    

    $ mount
    
    - sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) 
    - proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) 
    - udev on /dev type devtmpfs (rw,nosuid,relatime,size=4007548k,nr_inodes=1001887,mode=755) 
    - devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) 
    - tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=806368k,mode=755) 
    - /dev/sda3 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered) 
    - securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) 
    - tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) 
    - tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k) 
    - tmpfs on /sys/fs/cgroup type tmpfs (rw,mode=755) 
    - cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd) 
    - pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime) 
    - efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime) 
    - cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb,release_agent=/run/cgmanager/agents/cgm-release-agent.hugetlb) 
    - cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
    - cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer) 
    - cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct) 
    - cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset,clone_children) 
    - cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio) 
    - cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices) 
    - cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids,release_agent=/run/cgmanager/agents/cgm-release-agent.pids) 
    - cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event,release_agent=/run/cgmanager/agents/cgm-release-agent.perf_event) 
    - cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory) 
    - systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=27,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=16717) mqueue on /dev/mqueue type mqueue (rw,relatime) 
    - debugfs on /sys/kernel/debug type debugfs (rw,relatime) fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime) 
    - hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime) 
    - /var/lib/snapd/snaps/heroku_3534.snap on /snap/heroku/3534 type squashfs (ro,nodev,relatime) 
    - /var/lib/snapd/snaps/heroku_3560.snap on /snap/heroku/3560 type squashfs (ro,nodev,relatime) 
    - /var/lib/snapd/snaps/core_5145.snap on /snap/core/5145 type squashfs (ro,nodev,relatime) 
    - /var/lib/snapd/snaps/heroku_3538.snap on /snap/heroku/3538 type squashfs (ro,nodev,relatime)
    - /var/lib/snapd/snaps/core_5328.snap on /snap/core/5328 type squashfs (ro,nodev,relatime) 
    - /dev/sdb1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro) 
    - /dev/sda2 on /home type ext4 (rw,relatime,data=ordered) 
    - binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime) 
    - cgmfs on /run/cgmanager/fs type tmpfs (rw,relatime,size=100k,mode=755) tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=806368k,mode=700,uid=1000,gid=1000)
    - gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000) 
    - gvfsd-fuse on /home/valeriy/.gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0)
    - /dev/sdc1 on /media/valeriy/TERMINAL type vfat (ro,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
    

    How to resolve this task but not crack flash-card?

    • Daniele Santi
      Daniele Santi over 5 years
      Can you edit your question and post the output of sudo fdisk -l and mount with the card inserted?
    • pLumo
      pLumo over 5 years
    • mook765
      mook765 over 5 years
      It's mounted read-only. The reason might be a corrupted filesystem. askubuntu.com/questions/147228/… might be useful. Unmount the partition to run the file-system check.