1

I have an external HDD I took from a laptop, It has 2 partitions: 100MB they used for backuping (windows) and the rest 99.9GB in a separated partition.

The HD got corrupted due to poor powering in the raspy. I fixed that with an external Y usb cable to a cellphone charger (cutted the red cable to avoid back-powering he raspi)

The thing is that now the big partition is dissapeared and if I try to do stuf like fdisk -l the thing freezes when checking the HDD.

This is the output of df:

Filesystem     1K-blocks    Used Available Use% Mounted on
rootfs           7352320 1655860   5368012  24% /
/dev/mmcblk0p2   7352320 1655860   5368012  24% /
devtmpfs          191888       4    191884   1% /dev
none               38392     400     37992   2% /run
/dev/mmcblk0p1     34730   20040     14690  58% /boot
/dev/mmcblk0p2   7352320 1655860   5368012  24% /home
/dev/mmcblk0p2   7352320 1655860   5368012  24% /lib/modules
/dev/sda1         102396   24712     77684  25% /media/Reservado para el sistema
/dev/mmcblk0p2   7352320 1655860   5368012  24% /xbmc-backup

The raspi has an 8GB sd card on it. So I guess rootfs, mmcblk0p2 they all refere to stuff in my SD card and the sda1 is the 100Mb partition for back ups. There WAS an sda2 with the rest of the 99.9GB in there. And I was even able to enter it (it was auto-mounted in /media/usb2)

What I want to do is to fully destroy all the partitions on sda and fix all the sectors and re format that. I want to create one partition with 4GB or so for the OS, and move the OS from the SD to the HDD And the rest in NTFS for file sharing with my windows machines (physically or trough the LAN).

Summarizing, Questions:

  1. How can I reshape and reformat sda? (fdisk freezes in the middle of the process)
  2. What filesystem do I need to set in the small partition to hold the OS?
  3. What filesystem is the best to share files between the raspi and my win machines?

PS: I use xbian, I have XBMC running in there so xbian is a must :D

PSS: the system is headless so no gparted or other GUI things

  • It would be clearer if you say "OS" (Operating System) rather than "SO". – francis Feb 20 '14 at 12:31
  • edited, thanks. OS in spanish is SO XD, hence the confusion. Thanks – javirs Feb 20 '14 at 14:15
3

Since you don't need the data any more, you can use dd to fill the entire disk with zeroes:

dd if=/dev/zero of=/dev/sda bs=1M

Once that is done you should be able to use parted or fdisk to recreate your partitions.

Regarding filesystems, you will do fine using the standard ext4 filesystem. Sharing files over the network using SMB (or NFS/Netatalk for Unix and Macs respectively) is independent of the filesystem you format the drive with, so simply creating an ext4 filesystem throughout would be simplest.

However if you plan to unplug the drive and physically plug it into a Windows machine, you could consider the ntfsprogs package. I'm not sure how well that runs though, or whether it will eat up your (limited) CPU cycles.

  • I would hope that parted could delete it all for you anyway without you having to use dd first. – francis Feb 20 '14 at 13:15
  • Problem was related to powering the HDD, the method os Ok but my is not able to power the HDD during the whole process – javirs Feb 22 '14 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.