Announcement

Collapse
No announcement yet.

USB key falls into read-only file system

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    USB key falls into read-only file system

    Sorry if the subject is not clear. The point is, I have USB keys to which I can write, but when I want to erase the same file later, they have become read-only file systems. The one in question is /media/jon/T321:

    Code:
    $ pwd; ll
    /media/jon
    total 36
    drwxr-x---+ 6 root root    4096 avril 27 10:01 ./
    drwxr-xr-x  3 root root    4096 févr. 21  2017 ../
    drwxr-xr-x  8 jon  sjuser 16384 janv. 1  1970 T321/
    
    $cd T321
    ls -ld backups/
    drwxr-xr-x 7 jon sjuser 16384 avril 27 10:01 backups/
    
    $ cd backups/
    l$ ll
    total 112
    drwxr-xr-x 7 jon sjuser 16384 avril 27 10:01 ./
    drwxr-xr-x 8 jon sjuser 16384 janv. 1  1970 ../
    drwxr-xr-x 3 jon sjuser 16384 avril 15 21:15 180415/
    drwxr-xr-x 3 jon sjuser 16384 avril 27 10:02 180419/
    drwxr-xr-x 3 jon sjuser 16384 avril 22 18:04 180422/
    drwxr-xr-x 4 jon sjuser 16384 avril 23 18:26 180423/
    drwxr-xr-x 2 jon sjuser 16384 avril 27 10:00 180426/
    
    -rw-r--r-- 1 jon sjuser     0 avril 27 10:01 xx
    jon@jon-neon:/media/jon/T321/backups$
    As you can see, I just created file xx today, but I can not erase it or modify it, not even as root.

    Code:
    $ sudo chmod 755 xx 
    chmod: changing permissions of 'xx': Read-only file system
    What the hell kind of file system can be read-only to root?
    'I must have a prodigious quantity of mind; it takes me as much as a week sometimes to make it up.' Mark Twain

    #2
    Your file has either an i and/or an a attribute attached (immutable or append).
    chattr -i xx
    chattr -a xx

    Then delete it.

    PS - If that doesn't work then the directory it is in has one or both of those attributes.
    Use
    lsattr -d T321
    to check the attributes.
    chattr -d -suSiadAc T321
    will remove all of them.
    Last edited by GreyGeek; Apr 27, 2018, 11:34 AM.
    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
    – John F. Kennedy, February 26, 1962.

    Comment


      #3
      Originally posted by GreyGeek View Post
      Your file has either an i and/or an a attribute attached (immutable or append).
      What in the world are those? I know about unix (so, linux) file and directory permissions (drwxrwxrwx...), but never heard of i or a attributes. Does Linux/Ubuntu support those?

      And why would they have been applied to my file system just shortly after I wrote to it?

      I really would like to query such attributes before deleting the files. I tried lsattr, to no avail.

      Code:
      $ lsattr -d T321
      lsattr: Inappropriate ioctl for device While reading flags on T321
      'I must have a prodigious quantity of mind; it takes me as much as a week sometimes to make it up.' Mark Twain

      Comment


        #4
        How are you creating the backups on the device? A program or manually? If a program, which one? If manually, what command(s) are you using?
        Using Kubuntu Linux since March 23, 2007
        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

        Comment


          #5
          Read-only file system
          may also mean that the sticks were mounted read-only !

          what file system is on them and (with them mounted and accessible) what dose
          Code:
          findmnt
          show ?

          VINNY
          i7 4core HT 8MB L3 2.9GHz
          16GB RAM
          Nvidia GTX 860M 4GB RAM 1152 cuda cores

          Comment


            #6
            Originally posted by joneall View Post
            ....
            What the hell kind of file system can be read-only to root?
            FYI - https://www.tecmint.com/chattr-command-examples/
            "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
            – John F. Kennedy, February 26, 1962.

            Comment


              #7
              I should have mentioned that the key is formatted FAT32. Does that support file attributes?

              And here:

              Code:
              $ findmnt
              TARGET                                SOURCE     FSTYPE     OPTIONS
              /                                     /dev/sda5  ext4       rw,relatime,errors=remount-ro,data=ordered
              ├─/sys                                sysfs      sysfs      rw,nosuid,nodev,noexec,relatime
              │ ├─/sys/kernel/security              securityfs securityfs rw,nosuid,nodev,noexec,relatime
              │ ├─/sys/fs/cgroup                    tmpfs      tmpfs      ro,nosuid,nodev,noexec,mode=755
              │ │ ├─/sys/fs/cgroup/systemd          cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd
              │ │ ├─/sys/fs/cgroup/freezer          cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,freezer
              │ │ ├─/sys/fs/cgroup/devices          cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,devices
              │ │ ├─/sys/fs/cgroup/net_cls,net_prio cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,net_cls,net_prio
              │ │ ├─/sys/fs/cgroup/perf_event       cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,perf_event
              │ │ ├─/sys/fs/cgroup/blkio            cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,blkio
              │ │ ├─/sys/fs/cgroup/memory           cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,memory
              │ │ ├─/sys/fs/cgroup/hugetlb          cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,hugetlb
              │ │ ├─/sys/fs/cgroup/cpu,cpuacct      cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,cpu,cpuacct
              │ │ ├─/sys/fs/cgroup/cpuset           cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,cpuset
              │ │ └─/sys/fs/cgroup/pids             cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,pids
              │ ├─/sys/fs/pstore                    pstore     pstore     rw,nosuid,nodev,noexec,relatime
              │ ├─/sys/firmware/efi/efivars         efivarfs   efivarfs   rw,nosuid,nodev,noexec,relatime
              │ ├─/sys/kernel/debug                 debugfs    debugfs    rw,relatime
              │ └─/sys/fs/fuse/connections          fusectl    fusectl    rw,relatime
              ├─/proc                               proc       proc       rw,nosuid,nodev,noexec,relatime
              │ └─/proc/sys/fs/binfmt_misc          systemd-1  autofs     rw,relatime,fd=32,pgrp=1,timeout=0,minproto=5,maxproto=5,direct
              ├─/dev                                udev       devtmpfs   rw,nosuid,relatime,size=4009488k,nr_inodes=1002372,mode=755
              │ ├─/dev/pts                          devpts     devpts     rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000
              │ ├─/dev/shm                          tmpfs      tmpfs      rw,nosuid,nodev
              │ ├─/dev/hugepages                    hugetlbfs  hugetlbfs  rw,relatime
              │ └─/dev/mqueue                       mqueue     mqueue     rw,relatime
              ├─/run                                tmpfs      tmpfs      rw,nosuid,noexec,relatime,size=806188k,mode=755
              │ ├─/run/lock                         tmpfs      tmpfs      rw,nosuid,nodev,noexec,relatime,size=5120k
              │ └─/run/user/1000                    tmpfs      tmpfs      rw,nosuid,nodev,relatime,size=806188k,mode=700,uid=1000,gid=1001
              ├─/home/jon/jon-files                 /dev/sda4  ext4       rw,relatime,data=ordered
              ├─/boot/efi                           /dev/sda1  vfat       rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859
              ├─/mnt/areca-bak                      /dev/sdb2  ext4       rw,relatime,stripe=32750,data=ordered
              ├─/samba-transfer                     /dev/sdc6  ext4       rw,relatime,data=ordered
              ├─/home/jon/music-mp3                 /dev/sdc5  ext4       rw,relatime,data=ordered
              ├─/home/jon/our-pix                   /dev/sdc4  ext4       rw,relatime,data=ordered
              └─/media/jon/T321                     /dev/sde   vfat       rw,nosuid,nodev,relatime,uid=1000,gid=1001,fmask=0022,dmask
              The one in question is /media/jon/T321 on /dev/sde. Thanks for putting me onto the findmnt command. Any other gems like that?

              Btw, should I update Neon with "apt-get update; apt-get dist-upgrade" or with "pkcon refresh; pkcon update"?
              'I must have a prodigious quantity of mind; it takes me as much as a week sometimes to make it up.' Mark Twain

              Comment


                #8
                USB key falls into read-only file system

                FAT32 has six attributes, of which you can only change two: read_only and hidden


                Either command set can be used but out of habit I use
                sudo apt update
                sudo apt full-upgrade
                Last edited by GreyGeek; Apr 28, 2018, 06:22 AM.
                "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                – John F. Kennedy, February 26, 1962.

                Comment


                  #9
                  USB key files corrupted

                  When I take a closer look at the USB key, I see a couple of interesting things.

                  (1) Some files are corrupted. The ls command gives all sorts of weird symbols like you would expect from a binary file.

                  (2) From the point on where I try to delete a directory at a higher level, I get the error, the file system goes read-only (altho I know not how or where) AND, curiously, Dolphin does not even display the delete command when you right click on a file in the file system.

                  Since this has occurred several times with different USB keys, I am starting to question the effectiveness/utility of using them for backups.

                  I only use them for punctual backups, to have my latest modified document in my pocket. (Paranoia...) I regularly run areca backup for a more complete backup. But areca is slow for recovery.
                  'I must have a prodigious quantity of mind; it takes me as much as a week sometimes to make it up.' Mark Twain

                  Comment


                    #10
                    What is the brand of your USB keys and how big are they?
                    Could they be faked Chinese knockoffs? The ones that claim to be, say, 16GB but are actually only 4 or 2?
                    I use USB keys for both LiveUSB with persistence, and, for data storage too.
                    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                    – John F. Kennedy, February 26, 1962.

                    Comment


                      #11
                      Originally posted by GreyGeek View Post
                      What is the brand of your USB keys and how big are they?
                      Could they be faked Chinese knockoffs? The ones that claim to be, say, 16GB but are actually only 4 or 2?
                      I use USB keys for both LiveUSB with persistence, and, for data storage too.
                      The one in question with the file xx is a Transcend USB 3.0 32GB.

                      I too use them for live install storage. Installed Neon that way.
                      'I must have a prodigious quantity of mind; it takes me as much as a week sometimes to make it up.' Mark Twain

                      Comment


                        #12
                        If I run gparted, the only thing it will allow me to do with the bad key is to unmount it. Then, while looking for partitions on the key, gparted crashes.

                        So how do you format a key without partitions? To me that's the whole reason for formatting.
                        'I must have a prodigious quantity of mind; it takes me as much as a week sometimes to make it up.' Mark Twain

                        Comment


                          #13
                          Something seriously amiss somewhere. I can't ever recall a USB thumb drive becoming that corrupted, much less several of them. I did get a hold of a Chinese knock-off SD card once that was fake formatted like GG described. If this is happening to you often, you might want to review your storage habits (like - where you keep your thumb drives) or the PC that's causing this. I've even had an old Sandisk go through the laundry without losing data!

                          If you're looking to wipe the USB stick, use dd on it. Just run "sudo dd if=/dev/zero of=/dev/sde" - MAKE SURE THE USB DRIVE IS SDE OR DEATH AWAITS YOU (with nasty big pointy teeth)! Then you should be able to re-format it. You should run fsck on any new file system before putting files on it.

                          Please Read Me

                          Comment


                            #14
                            Hmm. Do you think keeping the key in my pocket along with a swiss army knife could damage it? I"ve heard stories about car or house keys doing that.
                            Last edited by joneall; Apr 30, 2018, 12:22 AM. Reason: error
                            'I must have a prodigious quantity of mind; it takes me as much as a week sometimes to make it up.' Mark Twain

                            Comment


                              #15
                              Originally posted by joneall View Post
                              Hmm. Do you think keeping the key in my pocket along with a swiss army knife could damage it? I"ve heard stories about car or house keys doing that.
                              On the surface, that doesn't seem likely. However, when I carry mine in my pocket I do so in an otherwise empty one. I supposed your knife, being steel, could have developed a small amount of magnetization. Long enough exposure to even a small magnetic field could cause bit-flipping I think. You must carry it a lot with that knife along side it.

                              How often does this sort of corruption occur? Here's an experiment; Start carrying two thumbs drives - one with the knife and your pocket change, the other alone. Use them both identically - double every action and always keep the same one in the empty pocket. If corruption occurs - you'll have your answer,.

                              Or maybe it's your magnetic personality!

                              Please Read Me

                              Comment

                              Working...
                              X