235

I'm trying to mount an hfsplus filesystem in a Xubuntu 12.04 VM (kernel version 3.2.0-23-generic) but when I type mount -o remount,rw /dev/sdb3 in command line it returns not mounted or bad option. Any help would be appreciated.

mook765
  • 15,925
Alkthree
  • 2,667

6 Answers6

331

The correct syntax is:

sudo mount -o remount,rw /partition/identifier /mount/point

Where mount/point is /partition/identifier's corresponding mountpoint, as listed by the following command:

mount -v | grep "^/" | awk '{print "\nPartition identifier: " $1  "\n Mountpoint: "  $3}'

For example, say that the above command gives this:

Partition identifier: /dev/sda1
 Mountpoint: /    

Partition identifier: /dev/sda2
 Mountpoint: /boot

Partition identifier: /dev/sda3
 Mountpoint: /test

The following would be the correct syntax. (We start by unmounting it, if it's already mounted.)

sudo umount /test
sudo umount /dev/sdb3
sudo mount -t hfsplus -o rw,remount -force /dev/sdb3 /media/untitled
Richard
  • 8,502
  • 11
  • 47
  • 72
SirCharlo
  • 39,486
  • Thanks for the response! I have been using sudo, forgot to include that. I'm by no means an advanced linux user, so I'm not exactly sure what I'm supposed to be seeing in /etc/fstab. However, when i type "df -h" it tells me that the hfsplus filesystem is mounted at /dev/sdb3 – Alkthree Aug 14 '12 at 14:21
  • 1
    I see what you're saying now, "mount -v | grep ^/" returns "/devsdb3 on /media/untitled".

    I tried "sudo mount -o remount,rw /media/untitled" and got the same problem-not mounted or bad option.

    – Alkthree Aug 14 '12 at 14:32
  • Have you tried sudo mountall? – SirCharlo Aug 14 '12 at 14:42
  • Let's continue this discussion in chat.. – SirCharlo Aug 14 '12 at 14:45
  • That command you posted returns ">" as if it is expecting input or something. – Alkthree Aug 14 '12 at 14:51
  • Oops! Fixed. :) – SirCharlo Aug 14 '12 at 14:52
  • Also, I can't chat, not enough reputation :/ – Alkthree Aug 14 '12 at 14:53
  • OK that command worked, but it's telling me the same thing. Partition identifier: /dev/sdb3 Mountpoint: /media/untitled – Alkthree Aug 14 '12 at 14:55
  • Ok.. try, then, sudo mount -o remount,rw /dev/sdb3 /media/untitled. Also, make sure that /media/untitled actually exists! – SirCharlo Aug 14 '12 at 14:55
  • I still get the not mounted or bad option message. This is getting frustrating haha. What do you mean make sure it exists? – Alkthree Aug 14 '12 at 14:59
  • Do ls -la /media/ to list that directory's contents. The untitled folder should exists, for the partition to be mounted in there! – SirCharlo Aug 14 '12 at 15:00
  • I have confirmed its existence! strangely it shows up as "drwxr-xr-x" doesn't that mean it should be read/write? – Alkthree Aug 14 '12 at 15:06
  • Yes, it should. Okay, now ls -la /media/untitled... – SirCharlo Aug 14 '12 at 15:07
  • Two entries, both with the same permissions (what I listed above). – Alkthree Aug 14 '12 at 15:12
  • sudo umount /media/untitled; sudo umount /dev/sdb3; sudo mount -o rw /dev/sdb3 /media/untitled; sudo mountall – SirCharlo Aug 14 '12 at 15:16
  • OK tried that. Firstly, after unmounting /media/untitled I got the message "/dev/sdb3: not mounted" after typing "umount /dev/sdb3". Typing "mount -o rw /dev/sdb3 /media/untitled" doesn't work because the mountpoint /media/untitled no longer exists, although I still see the "untitled" filesystem on my desktop. – Alkthree Aug 14 '12 at 15:21
  • sudo mkdir /media/test-mountpoint; sudo mount /dev/sdb3 /media/test-mountpoint – SirCharlo Aug 14 '12 at 15:33
  • If only it were that easy! I got a warning after mounting which read "warning: /media/test-mountpoint/ seems to be mounted read-only.Back to square one :( – Alkthree Aug 14 '12 at 15:42
  • K, this should do it. sudo umount /dev/sdb3; sudo umount /media/untitled; sudo rm -r /media/test-mountpoint; sudo apt-get install hfsprogs; sudo mount -t hfsplus -o force rw /dev/sdb3 /media/untitled – SirCharlo Aug 14 '12 at 15:45
  • No luck. The command didn't give me any errors or warnings, however I still can't write to the fs. – Alkthree Aug 14 '12 at 16:02
  • You can see your files though? If so, try sudo chmod -R a+w /media/untitled to give everyone write permissions on the files and folders on the volume. Note that you may want to think about this before actually doing it; I'm not responsible for any damage you cause to your (presumably) Mac partition.. :) – SirCharlo Aug 14 '12 at 16:05
  • See which files? As of right now there is nothing on the fs, it's just an empty hfsplus partition I created. I'm gonna hold off for now on that, don't want to damage the fs. I'll speak with my supervisor about where to go from here. Thank you for all your help! Much appreciated :) – Alkthree Aug 14 '12 at 16:10
  • May I ask why you want to use HFS+ as the filesystem? Anyway, see if you can sudo touch /media/untitled/test.txt – SirCharlo Aug 14 '12 at 16:12
  • Cannot touch, Read-only file system. I'm creating a test image with a couple different filesystems to run some forensic tools against. Cool stuff :) – Alkthree Aug 14 '12 at 16:20
  • Ok, last try, after I give up :) sudo mount -t hfsplus -o remount,rw,force /media/untitled – SirCharlo Aug 14 '12 at 16:23
  • Hmmm I don't think your last post was syntactically correct, it returned the usage for mount. – Alkthree Aug 14 '12 at 16:52
  • Grrr. sudo mount -t hfsplus -o rw,remount -force /dev/sdb3 /media/untitled – SirCharlo Aug 14 '12 at 17:08
  • Tragically, it's still read-only. – Alkthree Aug 14 '12 at 17:34
  • Thanks again for all of your effort in trying to solve this! – Alkthree Aug 14 '12 at 17:35
  • I'd feel better if you're problem was solved! :) – SirCharlo Aug 14 '12 at 18:38
  • Fixed it! dmesg revealed that it was not cleanly unmounted, then fsck fixed it. – Alkthree Aug 14 '12 at 19:35
  • 1
    Oh come on! That simple.. Good for you! :P In order to help clean up the site, please post the steps you took as an answer to your question and then accept your answer. This will prevent your questions from showing up in the Unanswered section. Thank you! – SirCharlo Aug 14 '12 at 19:38
  • I know right? That's probably where I should have started. Oh well, at least it's fixed. – Alkthree Aug 14 '12 at 20:44
  • Yes! Now, please mark your your answer as accepted. This will prevent your questions from showing up in the Unanswered section. Thank you! – SirCharlo Aug 16 '12 at 12:35
  • in case I am remounting as readonly, will this work with open files? – Aquarius Power Jan 21 '15 at 20:22
  • Does not work any of these by me, please check this, maybe you have an idea how to solve: http://askubuntu.com/questions/730822/cannot-mount-pendrive-in-write-mode – inf3rno Feb 07 '16 at 13:04
  • Sorry to revive an old thread... a recent 5-minute NAS problem caused an important partition to go into read-only mode in the middle of the night. When I woke up I fixed it right away, but I effectively had a 5-hour service downtime. Is there any downside to having a script check every 5 minutes for read-only mode and try a remount automatically? – dlo Sep 23 '16 at 16:13
  • If that's fine, this produces a list of remount commands, but how would you actually execute this in a script?: grep "^/" /proc/mounts | grep "\sro[\s,]" | awk '{print "mount -o remount,rw " $1 " " $2}' – dlo Sep 23 '16 at 16:31
  • Can I remount my / filesystem as read-only for a few hours just for purposes of a dd backup to external drive? Or does the system always need to be able to write to it's primary filesystem? – tgm1024--Monica was mistreated Feb 11 '21 at 17:04
  • You don't need the partition. mount -o remount,rw /mount/point is sufficient. – OrangeDog Aug 31 '23 at 16:48
60

for busybox/android users:

Oddly, I needed to add a space (in contrast to normal usage) between 'remount' and 'rw':

mount -o remount, rw /

otherwise it wouldn't work.

UPDATE: it seems that this is almost never the case (see comments). Not sure which busybox-version + android-version I was running. I'll just leave this here in case anyone still runs into it.

  • 3
    I did not need an extra space on my Busybox implementation. Or did you mean busybox and Android? My busybox is within an embedded controller (not a smart phone).... – wallyk May 09 '16 at 22:22
  • 1
    Had to do this on plain Ubuntu too. – DustWolf Sep 02 '16 at 18:01
  • 1
    what a strange syntax – phil294 Feb 27 '18 at 21:09
  • @wallyk i found this out when I ssh'ed into my rooted android (busybox is a necessary app in the playstore). It might have been an old version of busybox, as it was android v2 dot something. – coderofsalvation Mar 12 '18 at 09:37
  • This worked for me... mount -o remount,rw rootfs / since my /proc/mounts has rootfs / rootfs ro,seclabel,relatime 0 0 – Ray Foss Sep 07 '20 at 02:43
  • I didn't need any space between remount and rw – Bhargav Das Nov 19 '20 at 05:12
  • I needed the extra space when I had a major typo in my /etc/fstab file preventing it from even running. I could not edit the /etc/fstab since my file system was in read-only. For some reason, when I ran 'mount -o remount,rw /' I would get this error: "/ not mounted or bad option". The only solution was to run your command with a extra space. – Matthaeus Gaius Caesar Aug 30 '21 at 17:28
9

Running dmesg | grep hfs showed that the filesystem was unmounted incorrectly, which I was able to repair using

fsck.hfsplus /dev/sdb3/
Alkthree
  • 2,667
4

First, let us fix NTFS problems (if you have an Ubuntu/Windows dual boot setup)

sudo ntfsfix /dev/sda7

Before mounting we need a Directory (folder)

mkdir ~/Desktop/disk

Now mount the partition

sudo mount /dev/sda7 ~Desktop/disk

In this case "sda7" is the partition name. Now you read from and write to the partition.

Tooniis
  • 1,572
mmblack
  • 41
2

I have Dragonboard 410c I connecting via adb I wanted to mount the physical sdcard as RW. the following worked for me.

adb root
adb shell
su
mount -o remount,rw /storage/sdcard1   /storage/sdcard1

So I can now access it in rw mode as /storage/sdcard1

nb. /storage/sdcard0 is emulated and is /sdcard

0

First I typed mount to see the results and determine the mapping I wanted altered to full access was /media/linux/OLD_PC.

This worked fine to unlock the files and folders within my old Windows system partition.

sudo mount -o remount,rw /media/linux/OLD_PC  /media/linux/OLD_PC
Kulfy
  • 17,696
Noah
  • 1