boot partition of external hdd does not get recognized in partitioner

Hi,

Following SDB:Installation on external hard drive - openSUSE, I installed openSUSE 11.4 64bit to an external hdd for a test. I partitioned the hdd as the following:

/dev/sdb1 100 MB ext2 /boot Will be mounted read-only
/dev/sdb2 2 GB swap swap
/dev/sdb3 Max. N/A N/A Extended partition, which contains other partitions
/dev/sdb5 15 GB ext3 / (root) Logical partitions start counting at 5
/dev/sdb6 Max. XFS /home All remaining space can be used for /home

It worked well and now I want to repartition the drive to have only one partition with ext4.

The problem is when I plug in the hdd, my openSUSE system’s partitioner (or fdisk) only recognizes the extended partition (/dev/sdb3 in the example). I realized this after I deleted this partition and made an ext4 partition.
Funny thing is that I can mount the 100m partition for /boot in openSUSE. So in Device Notifier, there are two partitions showing, but in fdisk or partitioner, only one is showing.

Another weird thing is that I cannot mount both partitions simultaneously. I have to unmount one to mount the other. When I mount the previous /boot partition, the boot files are still there.

How do I delete this? I think the 2GB partition for swap is there as well.

Thank you,
Joon

You could at least have posted an *fdisk -l *listing. Even if you think it is lousy. So far we have nothing but your word about all these things that happened, but not one line from the system confirming this.

BTW, as you want to delete all that is now on the disk (if I understand correct), why not use fdisk and it’s o command (create a new empty DOS partition table) and then start creating the one partition you want from there. (This is one step less drastic then erasing the first block of the disk with dd and then creating a new table).

Oops. Sorry. The fdisk -l output for that particular hdd is:


Disk /dev/sdb: 160.0 GB, 160041885696 bytes
81 heads, 63 sectors/track, 61254 cylinders, total 312581808 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: 0x871650e8

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   312581807   156289880   83  Linux

As you can see, fdisk does not show the additional partition, even though it is there in the device notifier and I can actually mount it.

Please post the output of

ls -l /dev/sdb*

and

ls -l /dev/disk/by* | grep sdb

(BTW it isbetter to post those things including the prompt and the command. Thus we can see what you did without you having to tell that separatley).

Here we go.


joon@linux-wqvr:~> ls -l /dev/sdb*
brw-rw---- 1 root disk 8, 16 Sep 28 14:52 /dev/sdb

joon@linux-wqvr:~> ls -l /dev/disk/by* | grep sdb
lrwxrwxrwx 1 root root  9 Sep 28 14:52 usb-HITACHI_HTS722016K9SA00_081103D0D70D-0:0 -> ../../sdb
lrwxrwxrwx 1 root root  9 Sep 28 14:52 openSUSE\x20Live\x20CD\x20KDE -> ../../sdb
lrwxrwxrwx 1 root root  9 Sep 28 14:52 pci-0000:00:1a.7-usb-0:4:1.0-scsi-0:0:0:0 -> ../../sdb

Finally I see the usb-HITACHI_HTS … thing! And I did o command with fdisk and I haven’t created any partition yet.

It’s just I have about 4 drives connected to my computer at the moment and I did not want to paste all that. :slight_smile:

Here’s the output of the command on my laptop, with only one disk:


glosscomputer@Knurpht:~> ls -l /dev/disk/by* | grep sda
lrwxrwxrwx 1 root root  9 28 sep 21:07 ata-Kingston_SSDNow_64GB_YCBGK0S925SY925B4324 -> ../../sda
lrwxrwxrwx 1 root root 10 28 sep 21:07 ata-Kingston_SSDNow_64GB_YCBGK0S925SY925B4324-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 28 sep 21:07 ata-Kingston_SSDNow_64GB_YCBGK0S925SY925B4324-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 28 sep 21:07 ata-Kingston_SSDNow_64GB_YCBGK0S925SY925B4324-part3 -> ../../sda3
lrwxrwxrwx 1 root root 10 28 sep 21:07 ata-Kingston_SSDNow_64GB_YCBGK0S925SY925B4324-part4 -> ../../sda4

do you see the difference? There’s something competely wrong with the partitioning of the disk, I’ve seen this on the flash memory cards I use to run LiveCD’s from. IIRC I removed the partition table, wrote zeros to the MBR sector of the device, or to the complete device. If you plug the disk in I bet you also see 2 devices.

I am not sure about the sequence of what you did. Did you first do the listings and then the o command? Or the other way around?

I offered you in post #2 a way to get rid of everything in the partition table.

You answer was the fdisk listing and a story about mounts. That brought me to the conclusion that you first want to understand what is going on and then, later, wanted, maybe, go for a solution. Thus my asking for more listings in post #4.
But now you are destroying all evidence by doing (only half it seems) what I suggested as repair.

Now please: is the listing before or after you did the o command (and I guess, but you must confirm, also the w command) in fdisk.

Remember that I can NOT look over your sholder, thus you MUST tell exactly, precise and in sequence what you are doing. Else we are loosing a lot of precious time and effort.

@GertJan,
When he did use the o and w commands with fdisk, it is correct what he shows, a disk with an empty table. When that is wat he did (first make an empty table and then look for the device special files) we will never know what the problem was. Sigh…

Yes I see the difference. Could you please let me know how to completely reset the hdd?

I guess that part was what you did, but I don’t know how to do this so it would be great if you can let me know. :slight_smile:

This is a weird thing going on. I first thought I bought bad microSD’s but four in a row, different brands should not be true. Recently I noticed this (I have one “damaged”):


Knurpht:~ # fdisk -l


(snipped /dev/sda, which is the internal SSD)

Disk /dev/sdb: 1967 MB, 1967128576 bytes
64 heads, 32 sectors/track, 1876 cylinders, total 3842048 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: 0xd704f98b


   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           0     1423359      711680   83  Linux
/dev/sdb4         1423360     3842047     1209344   83  Linux


Disk /dev/sdb1: 728 MB, 728760320 bytes
64 heads, 32 sectors/track, 695 cylinders, total 1423360 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: 0xd704f98b


     Device Boot      Start         End      Blocks   Id  System
/dev/sdb1p1   *           0     1423359      711680   83  Linux
/dev/sdb1p4         1423360     3842047     1209344   83  Linux

If I put the card in the card-reader, the device notifier gives me three entries: openSUSE Live CD twice, hybrid once. I investigated what was on the partitions, the content of an openSUSE KDE Live CD, plus a parition where AFAIK the /home of the user linux is created. Yet it looked as if a third partition was on the card. I tried this:


Knurpht:/ # mount /dev/sdb /mnt
mount: warning: /mnt seems to be mounted read-only.

and take a look what’s in /mnt:

 
Knurpht:/mnt # ls -l
total 678838
drwxr-xr-x 4 399 399      2048 Mar  2  2011 boot
-rw-r--r-- 1 399 399       101 Mar  2  2011 config.isoclient
-rw-r--r-- 1 399 399 695126037 Mar  2  2011 openSUSE-kde-11.4-livecd-kde-read-only.x86_64-2.8.0
-rw-r--r-- 1 399 399       566 Mar  2  2011 syslinux.cfg

Output is the same when I mount /dev/sdb1. I continued my experiment, removed the partitions, created a brand new empty partition table, rebooted to make sure the kernel wasn’t holding any wrong info, output:


Knurpht:/ # fdisk -l


Disk /dev/sda: 64.0 GB, 64023257088 bytes
255 heads, 63 sectors/track, 7783 cylinders, total 125045424 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: 0x7eb9aff0


   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63    29366819    14683378+  83  Linux
/dev/sda2        29366820    58364143    14498662   83  Linux
/dev/sda3        58364145    62573174     2104515   82  Linux swap / Solaris
/dev/sda4        62573175   125033894    31230360   83  Linux


Disk /dev/sdb: 1967 MB, 1967128576 bytes
61 heads, 62 sectors/track, 1015 cylinders, total 3842048 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: 0x437b7e2d


   Device Boot      Start         End      Blocks   Id  System

Again, I attempt to mount /dev/sdb on /mnt, output:


Knurpht:/ # mount /dev/sdb /mnt
mount: warning: /mnt seems to be mounted read-only.
Knurpht:/ # cd /mnt
Knurpht:/mnt # ls -l
total 678838
drwxr-xr-x 4 399 399      2048 Mar  2  2011 boot
-rw-r--r-- 1 399 399       101 Mar  2  2011 config.isoclient
-rw-r--r-- 1 399 399 695126037 Mar  2  2011 openSUSE-kde-11.4-livecd-kde-read-only.x86_64-2.8.0
-rw-r--r-- 1 399 399       566 Mar  2  2011 syslinux.cfg

That’s not good, don’t understand what’s going on, and I was too busy to get into it at the time it was happening. But now I noticed the OP had a LiveCD on his disk, makes me curious what will be the outcome of mounting his /dev/sdb in /mnt and then look at the contents. No partition table to me means no files, no folders.

I’m sorry for the confusion. I did not say anything about your solution because I already said in my first post that I deleted all the partitions in fdisk and it did not work. I should have made it clear.

The listing I posted before was AFTER I did o command. I tried it again just in case.

Okay. Now I recreated a partition (160gb-ext4), with $ fdisk /dev/sdb, n, p, and default values. And the following is the output of fdisk -l (this time, whole thing) and ls -l /dev/sdb*, ls -l /dev/disk/by* | grep sdb.


linux-wqvr:/home/joon # fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 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
Disk identifier: 0x3fd6ce01

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      208895      103424   83  Linux
/dev/sda2          208896     4401151     2096128   82  Linux swap / Solaris
/dev/sda3         4401152  1953523711   974561280    f  W95 Ext'd (LBA)
/dev/sda5         4403200    56838143    26217472   83  Linux
/dev/sda6        56840192  1953503231   948331520   83  Linux

Disk /dev/sdc: 1000.2 GB, 1000202043392 bytes
255 heads, 63 sectors/track, 121600 cylinders, total 1953519616 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: 0x00021631

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048  1321203711   660600832    7  HPFS/NTFS/exFAT
/dev/sdc2      1321203712  1953519615   316157952   83  Linux

Disk /dev/sdd: 1499.7 GB, 1499748892672 bytes
255 heads, 63 sectors/track, 182334 cylinders, total 2929197056 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: 0xdf7cdbb3

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sdd2          206848  2929195007  1464494080    7  HPFS/NTFS/exFAT

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
81 heads, 63 sectors/track, 61254 cylinders, total 312581808 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: 0x1143fa85

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   312581807   156289880   83  Linux


linux-wqvr:/home/joon # ls -l /dev/sdb*
brw-rw---- 1 root disk 8, 16 Sep 28 15:57 /dev/sdb
brw-rw---- 1 root disk 8, 17 Sep 28 15:46 /dev/sdb1

linux-wqvr:/home/joon # ls -l /dev/disk/by* | grep sdb
lrwxrwxrwx 1 root root  9 Sep 28 15:57 usb-HITACHI_HTS722016K9SA00_081103D0D70D-0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Sep 28 15:46 usb-HITACHI_HTS722016K9SA00_081103D0D70D-0:0-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Sep 28 15:46 160gb-ext4 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Sep 28 15:57 openSUSE\x20Live\x20CD\x20KDE -> ../../sdb
lrwxrwxrwx 1 root root  9 Sep 28 15:57 pci-0000:00:1a.7-usb-0:3:1.0-scsi-0:0:0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Sep 28 15:46 pci-0000:00:1a.7-usb-0:3:1.0-scsi-0:0:0:0-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Sep 28 15:46 5c6dc359-a842-4672-84b0-85f7527507b0 -> ../../sdb1

IIRC, I used the below, but you’d better do a ‘man dd’ and check the options first.


dd if=/dev/zero of=/dev/sdb 

This worked. I did that and created a partition in fdisk, and now there is only one partition to mount and the one was gone. Tried to write some files to the drive and it seems to be working well.

It just took a lot of time, I guess I could just wiped the master boot record (would $ dd if=/dev/zero of=/dev/sdb bs=446 count=1 work?) as well.

Anyway thank you very much!!

-Joon

The dd was what I suggested also (and a count of 1 should be sufficint omho), but I do not understand why a new table (the o command) should not work on his own.

Still a bit of a mystery, but it works now. Concrats.

I had no idea about dd command until Knurpht show me the command. I must have overlooked your mention. Thanks!

-Joon