The following steps can be used to create a file system on a blank disk that has been inserted (usb or sata hot swap). Note 'parted' is required for partitions larger than about 2TB. For 2TB and larger it is easier to use fdisk. The example below used CentOS 5.

  • Use 'dmesg' to find the device name of the disk - usually something like /dev/sdX, /dev/vdX, or /dev/hdX (or look in /dev)
  • Use 'parted' to create the partition (substitute X with device letter). If the first 'print' command returns 'unrecognized disk label', then the disk is likely totally blank - create a new partition table with the command 'mklabel gpt'.
parted /dev/sdX
(parted) print                                                            

Model: WDC WD30 00FYYZ-01UL1B1 (scsi)
Disk /dev/sdd: 3.00TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart primary 0TB 3.00TB
(parted) print                                                            

Model: WDC WD30 00FYYZ-01UL1B1 (scsi)
Disk /dev/sdd: 3.00TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      0.00TB  3.00TB  3.00TB               primary       

(parted) quit                                                             
Information: Don't forget to update /etc/fstab, if necessary. 
  • Use 'mkfs' to make the filesystem (substitute X with device letter):
[root@andromeda:/home/dlane]$ /sbin/mkfs -t ext3 /dev/sdX1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
366297088 inodes, 732566637 blocks
36628331 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
22357 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848, 512000000, 550731776, 644972544

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@andromeda:/home/dlane]$
  • Use 'tune2fs' to set root reserved space to 0 (substitute X with device letter):
[root@andromeda:/home/dlane]$ /sbin/tune2fs -m 0 /dev/sdX1
tune2fs 1.39 (29-May-2006)
Setting reserved blocks percentage to 0% (0 blocks)
  • Add line to /etc/fstab and mount disk (substitute X with device letter):
/dev/sdX1 /backup2 ext3 defaults 0 0
[root@andromeda:/home/dlane]$ mount /backup2

 

Go to top