Partition external usb hard drive

I thought I posted this earlier but I must have done something wrong.

I was looking through a box of old stuff and found a usb enclosure with a 40GB hard drive. When I plug it in, it shows two partitions. That is, when it is recognized. Sometimes Tumbleweed sees it and other times it doesn’t. My Windows 10 install doesn’t see it. If I have it plugged in when booting, the booting stalls. It also stalls programs if I wait to plug it in until after a clean boot. It has at least 1 if not 2 OS partitions.

I would like to use it as storage. I am thinking I need to re-partition it but don’t know a safe procedure. If possible, I would like Windows to be able to access it. I might be able to plug it in my router. Can I mount it there for access from all devices in my home network? What file system do I select?

I don’t know why I didn’t try this earlier. I tried booting from the usb drive. It has a failed suse 11.2 installed on the drive. I say failed because it won’t boot. It goes through the boot process and stalls with this message

Could not find /dev/disk/by -id/ata-WDC and goes on with the drive description

At the end of the message is says

do you want me to fall back to (similar disk id number) part 2? y/n

It doesn’t matter which I pick it fails with this message

Inappropriate ioctl for device

The suse 11.2 boot screen has the option to boot to failsafe. That gives the identical result. When the boot fails, it drops to the command line with the $ prompt. About the only commands that work from there are ls and cd. If I have a command prompt, doesn’t that mean it booted? Just no gui.

Now what is the question?

Do you want to know why it is “recognized” one time and not on another occasion?
Then you should post what makes you think it is recognized or not. E.g. by posting

lsusb

to see if it is recognized as USB device.
Or/and

fdisk -l

to see if it added as mass-storage and to see if it has partitions or not.
Alternative you can use

lsblk

And of course when it connects sometimes and sometimes not, that is difficult to assess, but IMHO that points to a hardware failure.

Do you want to partition that mass-storage device?
Then first decide why you want to partition and how many partitions and what for. When your plan is ready you can use YaST > System > Partitioner to execute it.

Do you want to boot such an old system?
When you are really interested to resurrect that old system, I assume then your first question must be solved. Why is it detected sometimes only. Because when the hardware is broken, then during boot all sorts of things can happen. Including not finding partitions. Of course it is also possible that disks or partitions from disks that were available when the old system worked are now gone. But these are all things you should know better.

All I want to do is use it as a storage device; preferably accessible to Tumbleweed, Windows and/or storage attached to my router (a Linksys which permits attaching external storage.) It currently has 3 partitions: swap, system and home.

I was guessing it had to be a FAT partition. One partition is fine. Windows accessibility is NOT a necessity. There is nothing on the drive worth saving. I just don’t want to guess how to do this properly. The only time I’ve partitioned a disk was during an OS install and I just accepted the suggested setup.

This is the part that concerns me. It could indicate a hardware issue.

If there isn’t any hardware problem, you should be able to use Yast partitioner to do what you want. Or use “gparted”.

What does “lsblk --fs” (you’ll need to use the user “root”) indicate?

  • You can also use “fdisk -l /dev/sd**?**
    ” – where “?” is the letter for the USB drive indicated by “lsblk” – and/or “gdisk -l /dev/sd**?**”, to check if the Disklabel type is GPT or something else – such as DOS …

Like @nrickert, I assume it is not so interesting to find out what is on the disk now (the more because the OP wants to overwrite it with something new), but why the disk is detected one time and not the other. As long as it is not certain if the hardware can be trusted, any further step is useless IMHO
.

Henk, “lsblk --fs” is currently my “Swiss army officer’s knife” for the following information:

  1. Which /dev/sd? refers to which physical disk?
  2. Which UUID (default for openSUSE fstab mounts) refers to which partition?
  3. For each partition, what’s the filesystem type?
  4. Are the partitions mounted and, where?
  5. “Nice to have” – what are the Label values (character) for each partition?

In addition, once the /dev/sd? riddle has been solved, fdisk tells me which partition table type is present on the physical disk …

  • If the hardware is broken, “lsblk” and “fdisk” may error or, at least inform me of correctable errors on the physical disk …
  • “smartctl” goes further and, tells me if there’s a creeping block related error on the device …

You are corect, all that information is important, interesting and often needed.

But in this case, as long as we do not know if the device is broken or not the value of the information is nil.

And even if the device is OK, then we do not need that mass of information, as the OP is only interested in using the device removing/forgetting/ignoring all that is on it now. Only thing he needs is: how large is it, what is the device file to manage it and what is the plan.

“fdisk -l /dev/sd?” will show:

  • the size in MiB or, GiB or, TiB;
  • the manufacturer;
  • the model;
  • the UUID;
  • the Partition Table type – assuming that, it has a Partition Table …

“lsblk --fs” sorts out which device file (/dev/sd?) points to the device to be inspected – for example …


 # lsblk --fs
NAME   FSTYPE LABEL       UUID                                 FSAVAIL FSUSE% MOUNTPOINT
sda                                                                           
├─sda1 vfat               2539-7D44                             492,2M     2% /boot/efi
├─sda2 ext4               c59a64bf-b464-4ea2-bf3a-d3fd9dded03f   88,2G    13% /
└─sda3 swap               e96bee61-d116-4700-a761-c72153babfde                [SWAP]
sdb                                                                           
├─sdb1 ext4   System_Tmp  6b6e0183-7d30-47cd-81c4-f2d689b5ad65    3,7G     0% /tmp
├─sdb2 ext4   System_Srv  040ba129-ebeb-45b9-b1e8-5afa0a6dc006   92,6G     0% /srv
└─sdb3 xfs    UserHome    47c318a8-5bab-4b10-a2f5-c3cef374b645  803,7G     3% /home
sdc                                                                           
├─sdc1 ext4   System_Var  5588a7e3-d240-497a-9d5a-b6bfceca5f37   17,4G     6% /var
└─sdc2 xfs    UserHome01  bf8979ff-dce7-4bfc-b518-d1f9c7b1f6ae    3,4T     6% /home01
sdd                                                                           
├─sdd1 ext4   Tmp-Alt     944fc23c-e350-47ff-9439-904a11bc7709                
├─sdd2 ext4   Srv-Alt     92e3275b-51e6-4e9e-89d0-53925da216b0                
└─sdd3 xfs    Home-Alt    9eee3157-302c-47ec-b639-0e96e911b826                
sde                                                                           
├─sde1 ext4   System_Root 1ebd0398-732c-469a-9df5-af28273f743f                
└─sde2 swap               7f68961f-a69e-41c2-a64d-a0842fd94f0d                
sr0                                                                           
sr1    ext2   KWallet     697f371b-f1b4-4aa6-85c9-b949f9384412                
 # 

  • sdd is an older disk which should be removed from the system;
  • sde is the previous (not UEFI) system’s system disk;
  • sr1 is a DVD-RAM used for KWallet backups.

“smartctl --all /dev/sdd” indicates that, the raw Read Error Rate isn’t zero and, hardware ECC recovered more than zero ECC errors – which is why it’s being taken out of service …

  • If the device is suspected to be broken then “smartctl --test=short” will possibly indicate if it’s broken or, not …
  • If the device capacity is large, “smartctl --test=select,10-2000” may shake out some device errors …

To all posters who are trying to help me: I ask for your patience. I will try to get all the info you suggest, starting with this:

fdisk -l /dev/sdb
**Disk /dev/sdb: 37.28 GiB, 40020664320 bytes, 78165360 sectors**
Disk model: 0EB-00CPF0       
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: 0x897a897a

**Device****Boot****   Start****     End**** Sectors****  Size****Id****Type**
/dev/sdb1             63  1012094  1012032 494.2M 82 Linux swap / Solaris
/dev/sdb2  *     1012095 31953284 30941190  14.8G 83 Linux
/dev/sdb3       31953285 78156224 46202940    22G 83 Linux


From this I see there is a third (swap) partition and a boot partition. I wonder if that was giving me trouble accessing the drive. Does it try to boot when I access it? I guess just deleting the data on the drive is not enough. That partition has to go.

lsblk shows sdb2 and 3 to be ext4.

When I powered up the drive to run these commands, it wasn’t recognized. Shutting it off and powering on got it recognized immediately.

fIrst, I do not think there is a boot partition. There are three partitions and they probably are put there, when installing a system long time ago, as Swap, file system for / and file system for /home.

It is complete nonsense that it tries to boot when you access it.

It is just a disk filled with three partitions. Bit as you apparently (at least that is what I understand) want to use it for something completely different, it is of not interest what is on it now. Just forget that.

At a guess, it’s a Western Digital 40 GB drive – with an IDE physical interface – not a SATA drive …

  • To inspect what’s in the ext4 partitions, create 2 new directories below /mnt/ and then:

 # mount -t ext4 /dev/sdb2 /mnt/Dir01
 # mount -t ext4 /dev/sdb3 /mnt/Dir02

Once you’ve recovered whatever you need from those two ext4 partitions, reinitialise that disk:

  • Unmount /dev/sdb2 and /dev/sdb3
  • “dd if=/dev/urandom of=/dev/sdb iflag=fullblock bs=512 count=200000 status=progress”
  • Use the YaST Partitioner to reinitialise the disk and drop a new partition onto it.

Maybe not entirely…

Device     Boot    Start      End  Sectors   Size Id Type
/dev/sdb1             63  1012094  1012032 494.2M 82 Linux swap / Solaris
/dev/sdb2  *     1012095 31953284 30941190  14.8G 83 Linux
/dev/sdb3       31953285 78156224 46202940    22G 83 Linux

The asterisk in the “Boot” column of /dev/sdb2 shows that partition is flagged as bootable, but AFAIK fdisk makes no further check as to the presence or otherwise of any boot code.

It is nonsense. The only time that something boots from somewhere is when the hardware/firmware does a boot. Not when a disk is connected to a running system. I have no idea what the OP means with “access”, but when one or more of the file systems there is mounted, that will be not cause a boot. And you can add the swap partition to your swap space (and call that “access”) but the result will never be a boot.

Apologies. I should have read the entire thread. I wrongly assumed the OP had rebooted the system rather than connecting the drive to an already booted system. :embarrassed: …

I admit it is a bit confusing. In my first post I already asked what the goal is. As far as I understand it, the goal is to use the device for something new. Thus what is now on it is of no importance in spite of the good guidance given above by some on how to find out and how to recover.

Oooops!! – “A slip of the (forward) slash!!” …


 # mount -t ext4 /dev/sdb2 /mnt/Dir01/
 # mount -t ext4 /dev/sdb3 /mnt/Dir02/

I apologize to all for making this a difficult problem. It is harder than it should be, in part, because I’m embarrassed by my own ignorance and I was hoping to get answers without revealing that ignorance. I’ll try to be more clear.

To begin with, I’ve caused confusion when I talked about “accessing” this drive. All I meant was opening up dolphin to see what files were on the drive. It appears to me that this drive must have been pulled from an old desktop pc from years back. It has suse 11.2 installed on it.

I have connected it to my laptop two ways. First, I have it plugged in and powered up when I boot. It stalls the boot up process at, what I am guessing, is the bios setup stage. The laptop manufacturer’s logo is on the screen and it stays frozen there. If I power the drive off, it instantly continues the boot and I can re-power it up during the boot process and the boot continues. I did this a few times before I noticed there is now a pair of new grub entries for suse 11.2 milestone; one for the “regular” boot and one for advanced. Neither boot all the way. They fail saying they can’t find a file.

The second way I connect the drive is to wait until Tumbleweed has fully loaded and then power up the drive. There is a couple of minutes of disk activity (from the usb drive) then I get the pop-up saying a removable device is available with 2 partitions: one of 22 GB and the other 13.9 GB. That’s when I can “access” it via dolphin.

I have bootable usb thumb drives with other OS’s installed: Tails and linux Mint. My original post was looking for opinions: should I make this another bootable usb drive or just have more storage? I’ve decided on storage. This is where my embarrassment comes in. I can’t get past the first page of the yast partitioner because I don’t know what to choose. I select the sdb partition and select the tab that says partitions. I’m presented with 3 partitions: swap and the two listed above (although sdb2 now shows as 14.75 GB, not 13.9 GB). When the swap partition is selected, I have actions available. There is a modify drop-down box that says edit, resize or move. Next is a delete button. Then there is an add partition button, delete all button, an abort button, and finally, a finish button. I haven’t made any choice since I don’t know what will happen after that. Meaning will there be other choices I’m not prepared for when I’ve already done “something” to the drive.

All I want to do is end up with a single partition for storage and wipe out the vestiges of suse 11.2 milestone.

I think at that point, you just need to delete all three partitions. Then there should be an option to create a new partition, which is the partition that you want.

If you click “Abort” then it won’t actually do anything. It is at the end when you click “Finish” that it actually does the deleting, creating, formatting.