Unix disk partition

From DISI
Revision as of 15:43, 13 March 2014 by Frodo (talk | contribs)
Jump to navigation Jump to search

How to make a partition, label the partition and create a file system type.

In /media I created a directory backup

fdisk -l  -> To see a list of devices.  Say the device is listed as /dev/sdf

Note the size, so for our example: Disk /dev/sdf: 3000.6 GB, 3000592981504 bytes

parted /dev/sdf
print

It should say this:

(parted) print                                                       	 
Error: /dev/sdf: unrecognised disk label   	

If not, exit and try to select the device again.

(parted) mklabel gpt
(parted) mkpart logical 0TB 3TB
(parted) print                                                   	 
Model: Initio INIC-1610P (scsi)
Disk /dev/sdf: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
  
Number  Start   End 	Size	File system  Name 	Flags
 1  	1049kB  3001GB  3001GB  xfs      	logical
  
(parted)	
(parted) quit

Now when you type fdisk -l you should see under /dev/sdf a “/dev/sdf1” line Now type:

pvcreate /dev/sdf1
pvdisplay -> sanity check
vgcreate nfs_backup_vg /dev/sdf1
vgdisplay -> sanity check
lvcreate -l 100%FREE -n nfs_backup_lv nfs_backup_vg
mkfs.xfs -L nfs_backup /dev/mapper/nfs_backup_vg-nfs_backup_lv
mount -t xfs /dev/mapper/nfs_backup_vg-nfs_backup_lv /media/backup