Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Help with formating/partitioning HDD in debian 8. from terminal


  • Please log in to reply
2 replies to this topic

#1 K12RiV

K12RiV

  • Members
  • 67 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:09 PM

Posted 09 April 2016 - 01:36 PM

I have a 160gb hardrive i wanna use for my sever backups. its labeled /dev/sdc1 and i'm having trouble deleting and formating the drive. it has a previous windows installation on it and i want it tot be blank. itried using fdisk but get an error= The partition table has been altered. Calling ioctl() to re-read partition table. Re-reading the partition table failed.: Device or resource busy

 

 

 

Im looking for help formatin the drive from terminal since my server is headless. debian 8 jesse
 



BC AdBot (Login to Remove)

 


#2 Rocky Bennett

Rocky Bennett

  • Members
  • 2,598 posts
  • ONLINE
  •  
  • Gender:Male
  • Location:New Mexico, USA
  • Local time:01:09 PM

Posted 09 April 2016 - 01:38 PM

Do you have gParted installed on your Debian installation? This would be an easy task with gParted.

 

Sorry, I did not read that it was headless.

 

Carry on.


Edited by Rocky Bennett, 09 April 2016 - 01:38 PM.

594965_zpsp5exvyzm.png


#3 Guest_hollowface_*

Guest_hollowface_*

  • Guests
  • OFFLINE
  •  

Posted 09 April 2016 - 03:40 PM

Blank A Storage Device (CLI Method):
The below steps show how to blank a hard drive, or SSD, from the commandline on Debian 8. All data on the drive will be gone, so make sure you blank the correct drive! These steps require you to substitute some values in the commands. The substitutions are noted below the command.

Steps:
1. Reboot.
2. Login as Root. If your machine boots in text-only mode you can do this directly. If your machine boots in GUI mode you may need to login as a regular user and use SU to login as Root:

su root

2. Check to see if any partitions on the drive are currently mounted. If your output is empty then none are mounted:

mount -l | grep -a "sdc"

Substitute "sdc" for the hard drive in question. If you aren't sure which drive, use "parted -l" to see a list of drives.
3. Now that you know which partitions are mounted (if any), unmount any partitions on the drive that are currently mounted:

umount /dev/sdc1

Substitute "sdc1" for a partition that is currently mounted, and repeat for each partition. If no partitions are currently mounted you can skip this step.
4. Blank the drive:

sgdisk --zap-all /dev/sdc

Substitute "sdc" for the device you are blanking. Triple-check you've entered the correct device!
5. Logout of the Root account. If you used SU to login as Root you will need to use EXIT to get out of Root:

exit

Notes:
- Step #1 "Reboot" was placed in these instructions specifically for the OP. To other's who may stumble upon these steps in future, you only need to reboot if you're having issues with the drive being busy (despite having unmounted all partitions).
- These steps are written for Debian 8.
- These steps were tested using Debian 8.0 AMD64.
- These steps don't zero the drive. If your goal is to prevent data recovery you will need to take additional steps.


Edited by hollowface, 09 April 2016 - 03:42 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users