I think i am facing similar kind of issue where sometimes dd works and 
sometimes it say read only file system, but not able to alter the partitions on 
flash drive.
df -Th
Filesystem            Type      Size  Used Avail Use% Mounted on

/dev/sdb1             vfat      3.8G  2.5G  1.4G  65%
/media/tushar/TRANSCEND1

Zeroing out whole disk does not report any I/O issue.

tushar@tushar-Studio-1555:~$ sudo dd if=/dev/zero of=/dev/sdb1 bs=1M count=4096 
 
dd: error writing ‘/dev/sdb1’: No space left on device
3829+0 records in
3828+0 records out
4014866432 bytes (4.0 GB) copied, 227.406 s, 17.7 MB/s

Specific region doesn't report any issue in dd.
tushar@tushar-Studio-1555:~$ sudo dd if=/dev/zero of=/dev/sdb seek=446 bs=1 
count=64
64+0 records in
64+0 records out
64 bytes (64 B) copied, 0.000310444 s, 206 kB/s

removing MBR
tushar@tushar-Studio-1555:~$ sudo dd if=/dev/zero of=/dev/sdb seek=512 bs=1 
count=64
64+0 records in
64+0 records out
64 bytes (64 B) copied, 0.000279994 s, 229 kB/s

when i manually mount dd responds as below.
sudo mount | grep sdb
tushar@tushar-Studio-1555:~$ sudo mount -o rw  -force /dev/sdb 
/media/tushar/TRANSCEND
tushar@tushar-Studio-1555:~$ sudo mount | grep sdb
/dev/sdb on /media/tushar/TRANSCEND type none (rw,rce)
tushar@tushar-Studio-1555:~$ sudo dd if=/dev/zero of=/dev/sdb seek=446 bs=1 
count=64
dd: failed to open ‘/dev/sdb’: Read-only file system

tried to repartition on the disk but writing is failing.
 sudo fdisk -l /dev/sdb

Disk /dev/sdb: 4014 MB, 4014997504 bytes
57 heads, 56 sectors/track, 2456 cylinders, total 7841792 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
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1             256     7841791     3920768    b  W95 FAT32
tushar@tushar-Studio-1555:~$ 
tushar@tushar-Studio-1555:~$ sudo fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 4014 MB, 4014997504 bytes
57 heads, 56 sectors/track, 2456 cylinders, total 7841792 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
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1             256     7841791     3920768    b  W95 FAT32

Command (m for help): d
Selected partition 1

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

Error closing file
tushar@tushar-Studio-1555:~$ sudo fdisk /dev/sdb
You will not be able to write the partition table.

Command (m for help): p

Disk /dev/sdb: 4014 MB, 4014997504 bytes
57 heads, 56 sectors/track, 2456 cylinders, total 7841792 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
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1             256     7841791     3920768    b  W95 FAT32

Command (m for help): d
Selected partition 1

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 
Using default value 1
First sector (2048-7841791, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-7841791, default 7841791): 
Using default value 7841791

Command (m for help): p

Disk /dev/sdb: 4014 MB, 4014997504 bytes
57 heads, 56 sectors/track, 2456 cylinders, total 7841792 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
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     7841791     3919872   83  Linux

Command (m for help): w
fdisk: unable to write /dev/sdb: Bad file descriptor
tushar@tushar-Studio-1555:~$ sudo fdisk /dev/sdb
You will not be able to write the partition table.

Command (m for help): p

Disk /dev/sdb: 4014 MB, 4014997504 bytes
57 heads, 56 sectors/track, 2456 cylinders, total 7841792 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
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1             256     7841791     3920768    b  W95 FAT32

Command (m for help): q
=======================================================================================
=======================================================================================


tushar@tushar-Studio-1555:~$ sudo fdisk -l /dev/sdb

Disk /dev/sdb: 4014 MB, 4014997504 bytes
57 heads, 56 sectors/track, 2456 cylinders, total 7841792 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
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1             256     7841791     3920768    b  W95 FAT32
tushar@tushar-Studio-1555:~$ sudo parted -l /dev/sdb
Model: ATA WDC WD10JPVT-00A (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos

Number  Start   End     Size   Type      File system  Flags
 1      1049kB  800GB   800GB  primary   ext4         boot
 2      800GB   1000GB  200GB  extended
 5      800GB   801GB   999MB  logical
 6      801GB   1000GB  199GB  logical   ext4


Warning: Unable to open /dev/sdb read-write (Read-only file system).  /dev/sdb
has been opened read-only.
Model: JetFlash Transcend 4GB (scsi)
Disk /dev/sdb: 4015MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End     Size    Type     File system  Flags
 1      131kB  4015MB  4015MB  primary  fat32


Model: Linux device-mapper (crypt) (dm)
Disk /dev/mapper/cryptswap1: 999MB
Sector size (logical/physical): 512B/4096B
Partition Table: loop

Number  Start  End    Size   File system     Flags
 1      0.00B  999MB  999MB  linux-swap(v1)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/58331

Title:
  fdisk doesn't write partition table

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/58331/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to