1

I have 480 GB SSD it currently has the following partitions 256MB EFI partition, 16GB SWAP, and 40GB CentOS 7 see details from lshw below. I want to use the remaining 400GB of unused space on the drive as an iSCSI target. The system only has /dev/sda1, /dev/sda2, /dev/sda3, there is no /dev/sda4 mapped to the 400GB of free disk space on the SSD.

How do I add /dev/sda4 and map it to the unused 400DB on my disk so that it can be used as an iSCSI target? I am on CentOS 7.

*-scsi
          physical id: 1
          logical name: scsi3
          capabilities: emulated
        *-disk
             description: ATA Disk
             product: Crucial_CT480M50
             physical id: 0.0.0
             bus info: scsi@3:0.0.0
             logical name: /dev/sda
             version: MU03
             serial: 13440956E89D
             size: 447GiB (480GB)
             capabilities: gpt-1.00 partitioned partitioned:gpt
             configuration: ansiversion=5 guid=ab9704e2-9162-4c08-a759-956ad6a2f8f1 logicalsectorsize=512 sectorsize=4096
           *-volume:0 UNCLAIMED
                description: Windows FAT volume
                vendor: mkfs.fat
                physical id: 1
                bus info: scsi@3:0.0.0,1
                version: FAT16
                serial: fa26-fbee
                size: 255MiB
                capacity: 255MiB
                capabilities: boot fat initialized
                configuration: FATs=2 filesystem=fat name=EFI System Partition
           *-volume:1
                description: Linux swap volume
                vendor: Linux
                physical id: 2
                bus info: scsi@3:0.0.0,2
                logical name: /dev/sda2
                version: 1
                serial: c2b0907a-8337-4f32-b1e9-9affe6927264
                size: 15GiB
                capacity: 15GiB
                capabilities: nofs swap initialized
                configuration: filesystem=swap pagesize=4095
           *-volume:2
                description: data partition
                vendor: Windows
                physical id: 3
                bus info: scsi@3:0.0.0,3
                logical name: /dev/sda3
                logical name: /
                serial: f7efca38-7631-4a20-ae0a-04942971d5ba
                capacity: 39GiB
                configuration: mount.fstype=xfs mount.options=rw,seclabel,relatime,attr2,inode64,noquota state=mounted

fdisk -l output below.

fdisk -l /dev/sda
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sda: 480.1 GB, 480103981056 bytes, 937703088 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: gpt


#         Start          End    Size  Type            Name
 1         2048       526335    256M  EFI System      EFI System Partition
 2       526336     33294335   15.6G  Linux swap      
 3     33294336    115214335   39.1G  Microsoft basic 
  • Is the disk being listed in fdisk -l ? – Stark07 Aug 11 '14 at 8:11
  • @AshishKulkarni I have added the output of fdisk -l – ams Aug 11 '14 at 12:10
2

The first step is to create a partition. There's no entry in /dev for the free space because it's free space, not a partition.

You can use fdisk to create a partition. Run fdisk /dev/sda, then enter the n command and create a partition covering the free space. Once you're satisfied with the new partition table, enter the command w to write it to disk.

You may need to run partprobe /dev/sda to get the kernel to re-read the partition table.

Now you can add /dev/sda4 to your iSCSI configuration.

  • Better to use gdisk which is like fdisk but for GPT disks. Other than that it works the same as fdisk. – MLu Aug 12 '14 at 1:04
  • 1
    @MLu gdisk is also an option, but since the question indicates that fdisk is available and supports GPT partitions, fdisk is fine. – Gilles Aug 12 '14 at 1:08

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.