LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-24-2011, 11:07 AM   #1
destiny_aya
LQ Newbie
 
Registered: Nov 2011
Posts: 7

Rep: Reputation: Disabled
alternative of fdisk?


Hey All,

First i would like to introduce myself as a newbee of linux os. And offcourse i have encountered some problems (as many others) which i hope someone can help/advise me with...

I m currently playing with a computer running ubuntu-10.04.3-server 64 bits install of the first drive /dev/sda. In the computer i have 10 additional (old) used harddrive connect in the system.

on each of the old harddrive i have several partition (windows / linux) on it.

at first i try to remove all the partition with fdisk manually
fe:

fdisk /dev/sdb
> press d (to delete the partition)
> press w (to save and exit)

I was wondering if there is a alternative of fdisk / or an option in fdisk so i can remove all the partition in a drive in one command without fdisk /dev/sd[b-k] each time?

Thanks in advanced

best regards
 
Old 11-24-2011, 11:13 AM   #2
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,811
Blog Entries: 1

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
Hi and welcome to LQ.

I'm not aware of a way of doing it with fdisk. You might try cfdisk or a gui program gparted.
 
Old 11-24-2011, 11:25 AM   #3
destiny_aya
LQ Newbie
 
Registered: Nov 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
Smile

Dear sycamorex

thank you for your assistance

I try with cfdisk, but it seems like cfdisk have similar way of working as fdisk.

What i like to do is to remove all the partition in several disk in one command (big risk, but fun ).

I prefer not to work with gui program because I need to click several button to archive the same with fdisk or cfdisk...

do you have some other suggestion?

Thanks
 
Old 11-24-2011, 11:38 AM   #4
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 672

Rep: Reputation: 94
did you check out CLU parted? gparted uses it for partition work.
 
Old 11-24-2011, 11:42 AM   #5
destiny_aya
LQ Newbie
 
Registered: Nov 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
Dear ozanbaba,


can you provide me more information about "CLU parted", as I failed to find related info on google :$

Thanks
 
Old 11-24-2011, 11:45 AM   #6
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 672

Rep: Reputation: 94
https://en.wikipedia.org/wiki/GNU_Parted
 
Old 11-24-2011, 11:54 AM   #7
destiny_aya
LQ Newbie
 
Registered: Nov 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
thanks for your information

i tried with the code

Code:
parted /dev/sdz rm 1
: it works

but when i try with, (try to remove the first partition of drive sdb, sdc, sde, sdf)
Code:
parted /dev/sd[b-f] rm 1
: but it doesnt work

do you have suggestion?
 
Old 11-24-2011, 11:57 AM   #8
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,811
Blog Entries: 1

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
While generally I'm a big fan of cli ways of accomplishing things (for efficiency reasons), in this particular case it might actually be quicker to do it with gui.

Having said that, you could write a short bash script using the 'for' loop and the cli tool called 'dd' or 'parted' to wipe the partitions on chosen drives
Have a look http://www.cyberciti.biz/faq/linux-r...ta-empty-disk/
Bear in mind that automating wiping out stuff from a script might be dangerous and I wouldn't recommend it. As it's not a regular thing to do and because by the time you finish writing the script, you'd have finished doing the whole task in cfdisk/gparted a few times, I don't really see the point.
 
1 members found this post helpful.
Old 11-24-2011, 12:00 PM   #9
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 672

Rep: Reputation: 94
Well it might be your shell does not support [b-f] convension.

for i in $(/dev/sd*); do parted /dev/$i; done
/dev/sd disk etc.
 
Old 11-24-2011, 12:45 PM   #10
16pide
Member
 
Registered: Jan 2010
Posts: 418

Rep: Reputation: 83
If all your disks are exactly the same, you could use dd to erase the partitioning.
First unmount all those disks with the umount command.
Then use fdisk to erase all the partitions on one disk.
Then duplicate this to the other disks with dd:
dd if=/dev/sdb of=/dev/sdc bs=512 count=1
dd if=/dev/sdb of=/dev/sdd bs=512 count=1
dd if=/dev/sdb of=/dev/sde bs=512 count=1
etc ...

This command is powerful enough to destroy your linux install, so count on me to deny I told you to use it.
You said you want some fun ...
http://en.wikipedia.org/wiki/Dd_%28Unix%29
 
1 members found this post helpful.
Old 11-24-2011, 01:00 PM   #11
GazL
Senior Member
 
Registered: May 2008
Posts: 4,088
Blog Entries: 1

Rep: Reputation: 1536Reputation: 1536Reputation: 1536Reputation: 1536Reputation: 1536Reputation: 1536Reputation: 1536Reputation: 1536Reputation: 1536Reputation: 1536Reputation: 1536
Quote:
Originally Posted by ozanbaba View Post
Well it might be your shell does not support [b-f] convension.

for i in $(/dev/sd*); do parted /dev/$i; done
/dev/sd disk etc.
BAD ADVICE! THE ABOVE WILDCARD WILL ALSO MATCH sda!!!!!

... or at least it would have if oz' had gotten the syntax correct.


Listen to Sycamorex. He knows what he's talking about.
 
1 members found this post helpful.
Old 11-24-2011, 05:12 PM   #12
destiny_aya
LQ Newbie
 
Registered: Nov 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
thank you all for your advice

i tried out the the suggestion of sycamorex with the tutorials of http://www.cyberciti.biz/faq/linux-r...ta-empty-disk/, but it seems only to work sometimes, as i said before i used some old harddrive to play around, all the drive have different size...., maybe that s the reason it doesnt work?

the reason i m looking for a single command is because i'm planning to remove all partitions out of 45 drives (with difference sizes) in one command...

>>> building one of these at the moment

http://blog.backblaze.com/2011/07/20...-more-secrets/
 
Old 11-24-2011, 06:13 PM   #13
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,811
Blog Entries: 1

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
I don't think the size matters (I'm talking about hard.... drives). It might be a mixture of PATA/SATA drives so make sure you choose the right commands. Other than that, it's hard to say anything without more details. When you say sometimes it doesn't work, do you get any error messages?
 
Old 11-25-2011, 04:32 AM   #14
destiny_aya
LQ Newbie
 
Registered: Nov 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
ok, for example

initial status of 3 disk of the same size, but different partitioning etc...

Status of the disk /dev/sdu is actually what i want for all the disks

disk /dev/sdu has the following information according to the GUI disk utility
Capacity : 500 GB
Partitioning : Not Partitioned
Volumes: Unknown 500 GB
Usage: -
Partition Type: -
Device: /dev/sdu

output of fdisk
root@storage-pod:/dev# fdisk -l /dev/sdu
Code:
Disk /dev/sdu: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdu doesn't contain a valid partition table
disk /dev/sdv has the following information according to the GUI disk utility
Capacity : 500 GB
Partitioning : Master Boot Record
Volumes: Free 500 GB
Usage: Unallocated Space
Partition Type: -
Device: /dev/sdv

output of fdisk
Code:
root@storage-pod:/dev# fdisk -l /dev/sdv
Disk /dev/sdv: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a20e6

   Device Boot      Start         End      Blocks   Id  System
disk /dev/sdw has the following information according to the GUI disk utility
Capacity : 500 GB
Partitioning : Unknown Scheme
Volumes: RAID Component
Usage: RAID Component
Partition Type: Linux RAID autodetect
Device: /dev/sdw1

output of fdisk
Code:
root@storage-pod:/dev# fdisk -l /dev/sdw
Disk /dev/sdw: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdw doesn't contain a valid partition table


now i

Code:
dd if=/dev/zero of=/dev/sdv  bs=512  count=1
the disk /dev/sdv have the same output as /dev/sdu both in disk utility and fdisk = this is what i want = good

now i

Code:
dd if=/dev/zero of=/dev/sdw  bs=512  count=1

if i check the output of the fdisk, the result is actually what i want, .... but if i check the disk utility, nothing change?

disk /dev/sdw has the following information according to the GUI disk utility
Capacity : 500 GB
Partitioning : Unknown Scheme
Volumes: RAID Component
Usage: RAID Component
Partition Type: Linux RAID autodetect
Device: /dev/sdw1

output of fdisk
Code:
root@storage-pod:/dev# fdisk -l /dev/sdw
Disk /dev/sdw: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdw doesn't contain a valid partition table
any idea?
 
Old 11-25-2011, 04:55 AM   #15
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Disk utility is available through synaptic you can erase & create partitions, gparted also.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
understadning /dev/dm-02 mapping and fdisk -l or fdisk -l | less mixxmaster27 Linux - Newbie 2 06-03-2010 01:17 PM
Replacing fdisk with gnu fdisk in busybox? Alkisx Slackware 5 10-23-2009 12:51 PM
fdisk DaftDave Linux - Newbie 2 03-18-2008 02:42 PM
weird fdisk problem (Fdisk unable to see winxp partitions) khidot Slackware - Installation 5 04-07-2007 10:26 PM
Alternative to fdisk? NiallC Linux - General 6 02-05-2005 02:44 PM


All times are GMT -5. The time now is 06:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration