I'm running Ubuntu 14.10 Server (headless).
I have a group of USB flashdrives that I need to reformat for use across several devices. I've successfully mounted, formatted, copied files to, and unmounted three devices. Upon mounting the forth the system believes that the first partition of this drive has already been mounted; it has never been inserted into the server before. I cannot mount or unmount the partition at all. At this point I'm assuming that this is my fault somewhere along the way but I can't get things back to normal.
The USB drives are to be formatted with two partitions and an empty 8MB header. The table is required as they will be used for specialized equipment. Each device is roughly 2GB in size
USB Partition table (to-be): [-EMPTY 8MB-|-- >1.1GB FAT 16--|--751MB FAT16--]
The USB devices will have, at the very least, one pre-formatted partition of either Ext4 or Fat16.
I've inserted a new USB device. Attempting to mount the device fails:
$ sudo mount sdb1 mount: can't find sdb1 in /etc/fstab $ ls /media # Mounting a partition defaults to here <empty> $ pmount sdb1 Error: device /dev/sdb1 is already mounted to /media/sdb1 $ ls /media <empty>
df does not display
/dev/sdb1 at all
Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda2 944392620 35959148 860437980 5% / none 4 0 4 0% /sys/fs/cgroup udev 8183068 4 8183064 1% /dev tmpfs 1638852 5640 1633212 1% /run none 5120 0 5120 0% /run/lock none 8194244 0 8194244 0% /run/shm none 102400 4 102396 1% /run/user /dev/sda1 523248 3436 519812 1% /boot/efi
fdisk displays the device correctly
Disk /dev/sdb: 1.9 GiB, 1993342976 bytes, 3893248 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: 0x5651d77f Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 2353151 2351104 1.1G 83 Linux /dev/sdb2 2353152 3893247 1540096 752M 6 FAT16
GParted will display the device correctly (size, partition(s), table, etc.) but shows that
sdb1 is mounted. I can delete the partition, format to ext4, however I cannot format it to Fat16.
I can, however, mount
pmount and view any files that exist. Unmounting, partitioning, and erasing it is always successful. If I insert additional devices (e.g.
sdc) I can make any changes without issue. If I swap this device so that it is
sdc instead of
sdb I can still access it without any problems.
I'm assuming that I've goofed up and did not unmount properly
sdb1 on a previous device which is causing this problem. I'm also assuming that
mkfs.vfat is also experiencing issues because
mkfs.ext3,mkfs.ext4 will run without errors.
Is there a way to recover from this problem? Would my (only) solution be to reboot the system? I'm hoping to avoid this because we have multiple data-fetching and data-hosting services up and running.
Many thanks to steve for his simple solution. Of all my searches I did not happen to come across this.
pumount do not work then you should check
/etc/mtab next. This file had the following contents:
/dev/sda2 / ext4 rw,errors=remount-ro 0 0 proc /proc proc rw,nodev,noexec,nosuid 0 0 sysfs /sys sysfs rw,nodev,noexec,nosuid 0 0 none /sys/fs/cgroup tmpfs rw,uid=0,gid=0,mode=0755,size=1024 0 0 . . . systemd /sys/fs/cgroup/systemd cgroup rw,nosuid,noexec,nodev,none,name=systemd 0 0 /dev/sdb1 /media/sdb1 ext4 rw,nodev,nosuid,noexec,errors=remount-ro,user 0 0
That very last line was the source of the issue. Simply removing it fixed everything.
Please try using other guides/solutions before attempting this. I am not aware of any impact this could have on your system or device if other services are actively attempting to read/write/lock this partition.