[SOLVED] Mount an external write-protected disk with bad geometry on Ubuntu Server 16.04
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Mount an external write-protected disk with bad geometry on Ubuntu Server 16.04
I have this problem:
I can not mount an external usb disk formatted in ext3, where the blocks exceed the disk size, bad geometry message. Unfortunately I can not modify the disk doing the resize and I wanted to know if there is a possibility to mount it just to read some files.
Here the syslog:
Code:
Aug 16 16:34:22 CINE-SERVER4 kernel: [87896.226640] usb 3-11.4.2: new high-speed USB device number 7 using xhci_hcd
Aug 16 16:34:22 CINE-SERVER4 kernel: [87896.327197] usb 3-11.4.2: New USB device found, idVendor=13fd, idProduct=0840
Aug 16 16:34:22 CINE-SERVER4 kernel: [87896.327202] usb 3-11.4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Aug 16 16:34:22 CINE-SERVER4 kernel: [87896.327204] usb 3-11.4.2: Product: External
Aug 16 16:34:22 CINE-SERVER4 kernel: [87896.327206] usb 3-11.4.2: Manufacturer: Generic
Aug 16 16:34:22 CINE-SERVER4 kernel: [87896.327208] usb 3-11.4.2: SerialNumber: 333735535054513154202020
Aug 16 16:34:22 CINE-SERVER4 kernel: [87896.327621] usb-storage 3-11.4.2:1.0: USB Mass Storage device detected
Aug 16 16:34:22 CINE-SERVER4 kernel: [87896.327815] scsi host12: usb-storage 3-11.4.2:1.0
Aug 16 16:34:23 CINE-SERVER4 kernel: [87897.327119] scsi 12:0:0:0: Direct-Access Generic External 1.14 PQ: 0 ANSI: 4
Aug 16 16:34:23 CINE-SERVER4 kernel: [87897.328017] sd 12:0:0:0: Attached scsi generic sg3 type 0
Aug 16 16:34:23 CINE-SERVER4 kernel: [87897.328102] sd 12:0:0:0: [sdd] 1953525167 512-byte logical blocks: (1.00 TB/932 GiB)
Aug 16 16:34:23 CINE-SERVER4 kernel: [87897.328384] sd 12:0:0:0: [sdd] Write Protect is on
Aug 16 16:34:23 CINE-SERVER4 kernel: [87897.328387] sd 12:0:0:0: [sdd] Mode Sense: 23 00 80 00
Aug 16 16:34:23 CINE-SERVER4 kernel: [87897.328662] sd 12:0:0:0: [sdd] No Caching mode page found
Aug 16 16:34:23 CINE-SERVER4 kernel: [87897.329069] sd 12:0:0:0: [sdd] Assuming drive cache: write through
Aug 16 16:34:23 CINE-SERVER4 kernel: [87897.361692] sdd: sdd1
Aug 16 16:34:23 CINE-SERVER4 kernel: [87897.361700] sdd: p1 size 1953523120 extends beyond EOD, enabling native capacity
Aug 16 16:34:23 CINE-SERVER4 kernel: [87897.363982] sdd: sdd1
Aug 16 16:34:28 CINE-SERVER4 test-usb-mount.sh[17219]: Error mounting /dev/sdd1: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Error mounting /dev/sdd1 at /media/root/f4b0f1a8-06ef-4a4e-a595-da8d3a0042f9: Command-line `mount -t "ext3" -o "uhelper=udisks2,nodev,nosuid" "/dev/sdd1" "/media/root/f4b0f1a8-06ef-4a4e-a595-da8d3a0042f9"' exited with non-zero exit status 32: mount: /dev/sdd1 is write-protected, mounting read-only
Aug 16 16:34:28 CINE-SERVER4 test-usb-mount.sh[17219]: mount: wrong fs type, bad option, bad superblock on /dev/sdd1,
Aug 16 16:34:28 CINE-SERVER4 test-usb-mount.sh[17219]: missing codepage or helper program, or other error
Aug 16 16:34:28 CINE-SERVER4 test-usb-mount.sh[17219]: In some cases useful info is found in syslog - try
Aug 16 16:34:28 CINE-SERVER4 test-usb-mount.sh[17219]: dmesg | tail or so.
Aug 16 16:34:28 CINE-SERVER4 kernel: [87901.632812] EXT4-fs (sdd1): mounting ext3 file system using the ext4 subsystem
Aug 16 16:34:28 CINE-SERVER4 kernel: [87901.633108] EXT4-fs (sdd1): bad geometry: block count 244190390 exceeds size of device (244190389 blocks)
Aug 16 16:34:23 CINE-SERVER4 kernel: [87897.363988] sdd: p1 size 1953523120 extends beyond EOD, truncated
Aug 16 16:34:23 CINE-SERVER4 kernel: [87897.365384] sd 12:0:0:0: [sdd] Attached SCSI disk
I think I'd try some form of dd or such first on this to get an image if possible. Then I'd play with that image. I used to use ranish a long time ago and it may fix it. Might see what testdisk would say about this.
With an image you can play with things if you create a backup of the image. An image can be mounted like a disk.
Thank you for the reply.
I could try to get an image, but my problem is that my customer has to mount and umount it continuously, files are saved from a windows system that strangely has no problem to mount it, probably with some additional driver.So I was looking for some way to mount it even in read only to allow copying of files.
There are Windows ext drivers but if the drive's main purpose is to backup a Windows computer NTFS would be my preferred filesystem.
Quote:
Aug 16 16:34:22 CINE-SERVER4 kernel: [87896.327197] usb 3-11.4.2: New USB device found, idVendor=13fd, idProduct=0840
Aug 16 16:34:22 CINE-SERVER4 kernel: [87896.327202] usb 3-11.4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Aug 16 16:34:22 CINE-SERVER4 kernel: [87896.327204] usb 3-11.4.2: Product: External
Aug 16 16:34:22 CINE-SERVER4 kernel: [87896.327206] usb 3-11.4.2: Manufacturer: Generic
Aug 16 16:34:22 CINE-SERVER4 kernel: [87896.327208] usb 3-11.4.2: SerialNumber: 333735535054513154202020
Is this a drive from a well known manufacture like Western Digital or Seagate etc? If so then more information on the hardware is required. It could be that whatever hardware USB bridge you are using may not be passing the SCSI commands correctly.
That will create a device /dev/mapper/padded consisting of /dev/sdd1 padded with 4096 bytes of zeros. You should be able to mount /dev/mapper/padded. Use "dmsetup remove padded" when you are done.
I suggest resizing that filesystem to fit in its current partition.
Code:
resize2fs /dev/mapper/padded ${PSIZE}s
Note the "s" suffix applied to $PSIZE to indicate 512-byte sectors. You'll need to "fsck /dev/mapper/padded" first. Be sure that data is backed up. Shrinking a filesystem is inherently hazardous in the best of situations, and this is definitely not in that category.
Bus 002 Device 002: ID 8087:8002 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:800a Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 005: ID 174c:55aa ASMedia Technology Inc. ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/s bridge
Bus 004 Device 003: ID 2109:0812 VIA Labs, Inc. VL812 Hub
Bus 004 Device 002: ID 2109:0812 VIA Labs, Inc. VL812 Hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 005: ID 0557:2419 ATEN International Co., Ltd
Bus 003 Device 003: ID 0557:7000 ATEN International Co., Ltd Hub
Bus 003 Device 004: ID 2109:2812 VIA Labs, Inc. VL812 Hub
Bus 003 Device 002: ID 2109:2812 VIA Labs, Inc. VL812 Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Your answer sounds very close to my solution.
I'm sorry but I'm a developer and as a system administrator I hurts badly. Help me a little more, "get the actual size of partition sdd1 in 512-byte sectors"; How do I find the size? what command should I run to get it?
Glad you got it worked out. FYI, the quickest way to get partition sizes is by looking in /proc/partitions. The sizes there are in 1KB blocks, so you need to double them to get 512-byte sectors.
I love that dmsetup solution - you've mentioned it before, but I so rarely need it I forget it. Thanks.
BTW "blockdev --getsz ..." will work for both devices and partitions.
I love that dmsetup solution - you've mentioned it before, but I so rarely need it I forget it. Thanks.
BTW "blockdev --getsz ..." will work for both devices and partitions.
Thanks, with a padded device I was able to fix my issue.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.