3

I have a external storage that I would like to partition. enter image description here

It has 1 TB of space.

When I try to partition it using parted I get the following error,

p@p-ubuntu:~$ sudo parted
GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) select /dev/sdd                                                  
Using /dev/sdd
(parted) mkpart                                                           
File system type?  [ext2]? ext4                                           
Start? 1                                                                  
End? 10000
Error: Too many primary partitions.

print stmt

(parted) print
Model: Seagate BUP Slim Mac SL (scsi)
Disk /dev/sdd: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  1000GB  1000GB  ext4

Delete partition that is failing:

(parted) select /dev/sdd
Using /dev/sdd
(parted) print                                                            
Model: Seagate BUP Slim Mac SL (scsi)
Disk /dev/sdd: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  1000GB  1000GB  ext4

(parted) rm 1                                                             
(parted) print                                                            
Model: Seagate BUP Slim Mac SL (scsi)
Disk /dev/sdd: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  1000GB  1000GB  ext4
  • Why don't you print the existing partition table first. You're not trying to partition the disk with an already mounted partition are you? You already have a full terabyte partition on that disk, is that the result of your command, or are you trying to replace it? – ubfan1 Jul 06 '17 at 01:29
  • I need to create 4 partitions of 250gb each, currently I just pluggged in my device and mounted it. Haven't done much Linux partitions, so wondering if I'm doing the right thing – user1050619 Jul 06 '17 at 01:50
  • also, given the ouput of print stmt – user1050619 Jul 06 '17 at 02:15
  • you have to delete the partition that is already there, there is no space left. and the drive should be unmounted – ravery Jul 06 '17 at 02:40
  • 2
    'loop' is not standard partitioning, but usually an unpartitioned formatted drive that looks like a superfloppy. If you can mount drive, back up all your data and do gpt or MBR partitioning. http://askubuntu.com/questions/629470/gpt-vs-mbr-why-not-mbr – oldfred Jul 06 '17 at 03:36
  • @oldfred #ubfan1 : Thanks..How do I delete the existing partition? I tried to use the rm "1"(partition number) command but that does not work..I given the output above. – user1050619 Jul 06 '17 at 09:21
  • 2
    You may have random data in the area where partition table normally is. And then to write new data you may need to erase the beginning of the drive. You need to use dd, but dd's nickname is Data Destroyer. And if you type anything wrong, your data is gone. Double check drive order, sometimes a flash drive changes which drive is sdb, sdc etc. Change sdX to correct drive: sudo dd if=/dev/zero of=/dev/sdX bs=512 count=1 then gparted should see blank drive. – oldfred Jul 06 '17 at 13:51
  • @ravery: Hi there! You have found the comments section, which is an area dedicated to critiquing and requesting clarification. To provide an answer/solution, you should use the "answer" section below (look for the big red "Post Your Answer" button). Hope that helps! – Lightness Races in Orbit Jul 07 '17 at 14:00

1 Answers1

3

Oldfred's comment contains all the necessary steps. What happened is that a filesystem was put directly on the sdd instead of on a partition, so sdd really doesn't have any partition table -- it gets mounted like a file with the loop option. Backup whatever you want to save on the disk, because putting a partition table on it will make what's there unreadable. Then ensure the device is unmounted, and run your partition tool to first put on a partition table (your choice DOS or GPT -- see oldfred's link to decide). Then you can make your partitions.

If you choose GPT, you can make however many you want (well up to some limit like 128 by default). If you chose DOS, then you can make up to 4 primary partitions. For more than four, you will need to make one primary partition an extended partition, and then you can make logical partitions within the extended partition. For example, you make 4 partitions of type 83 (linux), of 250G each, filling up the disk. Save the partition table. Now, you need to make filesystems on the new, empty partitions with mkfs, for example:

sudo mkfs.ext4 /dev/sdd1  

Now the new partitions may be mounted, and files copied onto them.

ubfan1
  • 17,838