2

I use my USB as a extra storage in Raspberry pi 2 (Raspbian jessie) I need to make a directory using 'mkdir', but it occurs errors:

mkdir a
>> mkdir: cannot create directory ‘a’: Read-only file system

My USB path is : /media/pi/EE5EB2A05EB2614F

and

fdisk -l : enter image description here

Also I can not download any files using wget.

Need your helps. Thanks :)

1

You have mounted a NTFS drive on unix, by default this is read-only. If you wish to mount NTFS to be able to write to, you will need NTFS-3G.

Do know that NTFS in linux adds a rather large amount of overhead. An overhead that does pose a noticeable decrease in performance on a Pi.

Consider using FAT32 or EXT3/4 instead, if this is an option.

| improve this answer | |
2

Make sure you have the NTFS driver in place (use sudo when required):

apt-get install ntfs-3g

then find the location and name assigned to the device when external drive was mounted. This location may change, you can use the 'UUID' to make it location independent (Universally Unique Identifier) (*).

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 / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0002f5f9

Device     Boot Start        End    Sectors   Size Id Type
/dev/sda1        2048 1953521663 1953519616 931.5G  7 HPFS/NTFS/exFAT

in this case, was /dev/sda1.
Create a mounting point, you pick the name, in my sample: (sda1) and location (mnt):

mkdir /mnt/sda1

finally, mount the partition:

mount -t ntfs-3g /dev/sda1 /mnt/sda1

if you want the device mounted at boot time, add the following line to the /etc/fstab table:

/dev/sda1    /mnt/sda1    ntfs-3g        defaults    0    0

if you finish using the device, just umount it, do this otherwise the partition will be marked as dirty and may need a cleanup on next mount.

umount /mnt/sda1

If you want to mound a drive location independent, use UUID; to find the 'UUID' there are a few methods:

blkid

/dev/mmcblk0: PTUUID="0002f5f9" PTTYPE="dos"
/dev/mmcblk0p1: LABEL="RECOVERY" UUID="9A44-F44C" TYPE="vfat" PARTUUID="0002f5f9-01"
/dev/mmcblk0p5: LABEL="boot" UUID="075A-7251" TYPE="vfat" PARTUUID="0002f5f9-05"
/dev/mmcblk0p6: LABEL="root" UUID="06d6c18f-e293-4cac-9126-a4108baa1bb9" TYPE="ext4" PARTUUID="0002f5f9-06"
/dev/sda1: LABEL="western digital" UUID="1C0EBC7A0EBC4F10" TYPE="ntfs" PARTUUID="0002f5f9-01"

and also:

ls -shal /dev/disk/by-uuid/

lrwxrwxrwx 1 root root 15 2016-02-18 06:10 06d6c18f-e293-4cac-9126-a4108baa1bb9 -> ../../mmcblk0p6
lrwxrwxrwx 1 root root 15 2016-02-18 06:10 075A-7251 -> ../../mmcblk0p5
lrwxrwxrwx 1 root root 15 2016-02-18 06:10 9A44-F44C -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 10 2016-03-03 06:41  -> ../../sda1

You will noticed that our external drive UUID is '1C0EBC7A0EBC4F10'. so, now instead of using the physical location (ie sda1) use the UUID:

mount /dev/disk/by-uuid/1C0EBC7A0EBC4F10 /mnt/sda1
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.