6

The Problem

It was a bootable Ubuntu USB drive at first I tried to format it using Nautilus it didn't work, then i simply deleted the partition using Gparted and created a new FAT32 partition. but when I tried to copy anything to the USB drive it gave me this error. I'm the owner of the location, technically I should be able to write to it.

Screenshot

What I've tried so far

  1. Tried formatting the partition to NTFS, it gave me the same error

  2. Tried formatting the partition to EXT4, root took the ownership of the location, I got the ownership back by running

    chown -R user:user PATH
    

    it did work, I became the owner but the error was still there.

  3. Tried formatting using Disk app, formatting was successful but I still can't write.

  4. Since it's a USB OTG drive, I tried connecting it to my Phone (Nexus 5) and strangely I can write to it from my phone (using ES file Explorer), written files are visible in Nautilus but i still can't write new data to it using Nautilus

  5. I don't have windows installed so I can't format it from there.

output of lsblk

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdb      8:16   0   1.8T  0 disk 
├─sdb4   8:20   0   713G  0 part /mnt/Series
├─sdb2   8:18   0   220G  0 part /mnt/Movies
├─sdb3   8:19   0   710G  0 part /mnt/Hollywood
└─sdb1   8:17   0   220G  0 part /mnt/Stuff
sdc      8:32   1  15.1G  0 disk 
└─sdc1   8:33   1  15.1G  0 part /media/sumeet/bb499853-a4a5-40dd-
a5cc-c94d4ec0a
sda      8:0    0 111.8G  0 disk 
├─sda5   8:5    0  14.3G  0 part /
├─sda1   8:1    0   7.6G  0 part [SWAP]
└─sda6   8:6    0  89.9G  0 part /home

Disk is question here is dev/sdc1 which is Strontium Nitro USB drive

output of mount is posted here at Paste Ubuntu

output of ls -l /media/sumeet/rupam

total 5568
-rw-r--r-- 1 sumeet sumeet 1833612 Apr 11  2017 IMG_20170325_191153.jpg
-rw-r--r-- 1 sumeet sumeet 2537997 Apr 11  2017 IMG_20170329_200512.jpg
-rw-r--r-- 1 sumeet sumeet 1319450 Apr 11  2017 IMG_20170407_085110.jpg

UPDATE (I've written this section in little bit of rush, if it needs further explanation, please ask)

I tried running this command as suggested in the answer

sudo dd if="/dev/zero" of="/dev/sdc1"
sudo reboot

which took forever, and after reboot my USB drive wasn't mounted I tried to mount it at /mnt/sdc1 by running

sudo mount -o rw,users,umask=000 /dev/sdc1 /mnt/sdc1

which gave me this output
mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
   missing codepage or helper program, or other error

   In some cases useful info is found in syslog - try
   dmesg | tail or so.

when I last formatted it I clearly remember it being ext4 partition on the USB drive, so i ran this command to fix that I've used this command before on same issue on my /dev/sdbn partitions

 sudo e2fsck -f -b 32768 -y /dev/sdc1

now it says

e2fsck 1.43.3 (04-Sep-2016)
e2fsck: Bad magic number in super-block while trying to open /dev/sdc1

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>

Is their a way that I can know that my partition (USB drive) was actually Ext4?

after all this sudo lsblk -f isn't showing any partition type on my drive

NAME   FSTYPE LABEL     UUID                                 MOUNTPOINT
sdb                                                          
├─sdb4 ext4   Series    707694b6-97b8-4374-9283-c98192591486 /mnt/Series
├─sdb2 ext4   Movies    b2d7f1a7-f3e6-4ca5-9925-d8225c897e4d /mnt/Movies
├─sdb3 ext4   Hollywood c2104e2a-cc8e-4b7b-9bba-a05d316472b4 /mnt/Hollywood
└─sdb1 ext4   Stuff     54c9765b-af6d-4a62-905f-09b56e280178 /mnt/Stuff
sdc                                                          
└─sdc1                                                       
sda                                                          
├─sda2                                                       
├─sda5 ext4             1cdd8ee7-c5c6-4bd6-af9b-9ed320f50c30 /
├─sda1 swap             d1749176-6c41-4961-a6bd-0c6a56968970 [SWAP]
└─sda6 ext4             161aa7c2-8e61-4848-8615-49cf66d80130 /home

UPDATE 2

mkusb finally solved my problem, USB drive is back and fully working

mkusb community wiki

  • 1
    Please [edit] your post to include the output of lsblk and mount Thank you for helping us help you! – Elder Geek Apr 10 '17 at 16:26
  • @ElderGeek should i include the output of mount in the post or paste ubuntu is fine? – Sumeet Deshmukh Apr 10 '17 at 16:35
  • Formatting the whole USB drive using Disks may be worth a try. – Gunnar Hjalmarsson Apr 10 '17 at 17:03
  • @GunnarHjalmarsson tried that too, error is still present – Sumeet Deshmukh Apr 10 '17 at 17:07
  • 1
    Maybe the problem is 'only' how it is mounted. Please try according to the following link, https://askubuntu.com/questions/895733/copying-files-to-a-usb-drive/895782#895782 – sudodus Apr 10 '17 at 17:35
  • @sudodus I'm gonna try it, first thing in the morning, I'll update the question with results – Sumeet Deshmukh Apr 10 '17 at 17:40
  • 1
    @SumeetDeshmukh a paste link is fine. – Elder Geek Apr 10 '17 at 17:42
  • Please also [edit] into your post the output of ls -l /media/sumeet/bb499853-a4a5-40dd- a5cc-c94d4ec0a – Elder Geek Apr 10 '17 at 17:49
  • 1
    @sudodus i tried everything that answer has asked me to do, but nothing has changed, i could write with sudo privileges as suggested in the answer. cat as user also worked i could see the content of the text file, unfortunately test deleting as user rm didn't work nor did the test writing as user, finally i did the last step, unmounted and then mounted with full permission, it got mounted with full permission but error still exists. – Sumeet Deshmukh Apr 11 '17 at 02:27
  • @AndroidDev I tried running your command, and it might have solved my problem, but created a new one, I've updated the question with relevant information, it's probably because i did something wrong. – Sumeet Deshmukh Apr 11 '17 at 03:33
  • @AndroidDev or should I ask a new question as update section seems like a new problem altogether? – Sumeet Deshmukh Apr 11 '17 at 03:52
  • 2
    I'd trysudo dd if=/dev/zero of=/dev/sdc bs=1M count=1to erase the boot-sector and reformat the drive. – mook765 Apr 11 '17 at 05:09
  • 1
    I suggest that you do the task suggested by @mook765 or safer with mkusb, which wraps a safety belt around dd. See this link, https://askubuntu.com/questions/769079/cant-format-ubuntu-installation-stick/897142#897142 – sudodus Apr 11 '17 at 06:29
  • You are making progress and the drive is working :-) Otherwise you would have failed when writing with sudo privileges. I think you can try a little more and after a while you will also succeed in mounting the drive in a way that allows you to write as a regular user. Please edit your original question to post the output of the following three command lines, sudo lsblk -f and sudo lsblk -m and sudo parted -ls again just after one another. I suspect there is something wrong with the file system because no information was shown when you ran sudo lsblk -f last time. – sudodus Apr 11 '17 at 06:38
  • @sudodus mkusb finally came through, such a little useful program. drive is working completely fine now, anyways should I just update the question with sudo lsblk -f sudo lsblk -m and sudo parted -ls. outputs. so that other users could see it? – Sumeet Deshmukh Apr 11 '17 at 06:49
  • 1
    @SumeetDeshmukh, mook756's comment above is correct. I've added an answer with the exact steps to take. Your problem was that you used dd to copy from /dev/zero to a partition on /dev/sdc. You want to write zeros to the device /dev/sdc itself. Your problem lies in the data in the space on the device that comes before the first partition. – b_laoshi Apr 11 '17 at 06:59
  • 1
    @b_laoshi thanks for that, but my problem is now resolved by using mkusb which is safer way of performing the same thing that you guys told me to do, if you could update your answer with this alternative (and safer) way, I would accept that answer and we'll mark this question as solved, thanks again everyone – Sumeet Deshmukh Apr 11 '17 at 07:04
  • I'm glad you have a USB drive that works now :-) Since it is working, you need not update the question with sudo lsblk -f sudo lsblk -m and sudo parted -ls . Other people can be helped by the commands, but need not see the result in your particular case. – sudodus Apr 11 '17 at 07:05
  • and I'm glad that I don't have to type more, thanks again – Sumeet Deshmukh Apr 11 '17 at 07:07
  • You need not type much :-) You can mark (press the left button while moving the cursor) and paste (press the middle button or wheel to paste) from a terminal window to the editing box of AskUbuntu. Finally indent 4 spaces or mark and press the {} icon to render it as code in AskUbuntu. – sudodus Apr 11 '17 at 07:16
  • @sudodus one more thing, can I edit the existing answer with what worked for me and accept it? so we can close it down as solved? or can you? (it was initially your answer anyway) – Sumeet Deshmukh Apr 11 '17 at 07:22
  • @SumeetDeshmukh, it looks like mkusb is only available through a ppa (it's not in the main repos). IMO, if it hasn't been deemed fit for the main repos, I wouldn't consider its use to be safer than using dd. For security reasons, I, personally, wouldn't recommend to anyone that they add a ppa even though I might use some myself. I would recommend that you post a separate answer using the mkusb tool. – b_laoshi Apr 11 '17 at 07:24
  • I think you can edit it. But someone with more 'reputation' points must accept it before other people can see it. – sudodus Apr 11 '17 at 07:25
  • @b_laoshi that makes sense – Sumeet Deshmukh Apr 11 '17 at 07:26
  • OK @b_laoshi does not want mkusb in their answer. We must show respect to that opinion. – sudodus Apr 11 '17 at 07:26
  • @sudodus should I just make a new answer? – Sumeet Deshmukh Apr 11 '17 at 07:27
  • Yes, if you wish. You are not the first person who answers their own question. – sudodus Apr 11 '17 at 07:28
  • 1
    @b_laoshi, I think the reason why mkusb is not in a debian repo is that the debian people are happy with dd. They consider dd safe enough. And I think the reason why mkusb is not in an ubuntu repo is that the ubuntu people are happy with the Startup Disk Creator and Disks (and dd). But I have seen many cases when dd has overwritten valuable data, and I have seen people having difficulties with the Ubuntu tools, so I made mkusb, first for myself, then I developed and uploaded it to a Launchpad PPA. But I understand and accept that you do not consider it safe. – sudodus Apr 11 '17 at 07:37
  • @sudodus you're the developer of mkusb ? it's amazing man, it really saved my a__ because that USB drive wasn't mine. I know we can't talk personal here, but thanks again and thanks alot – Sumeet Deshmukh Apr 11 '17 at 07:39

1 Answers1

6

I've had this same issue with recent versions of Ubuntu when creating Live USBs. If your issue is the same as mine, the fix I have implemented is a very simple one. The issue seems to be related to the file system dumped onto the USB when you create an Ubuntu Startup Disk. Wiping the very beginning of the USB device erases whatever causes this problem.

Here's what you want to do.

  • Determine the path to your device, not the partition path. Mine is /dev/sdd. The device path will never end with a number! Numbers indicate partitions on the device. The device path should look something like /dev/sdX, where X is a letter a-z. Use the gnome-disks tool, select your device, and look at the window title.disks.png
  • Make sure none of the partitions on your USB device are mounted.
  • Armed with your device path run the following command, replacing /your/device with your device path (WARNING: this will destroy existing data on the device you provide the path for)

    sudo dd if=/dev/zero of=/your/device bs=1M count=10
    
  • Finally, now try reformatting your USB, and it should be back to normal

b_laoshi
  • 4,660
  • 4
  • 25
  • 46