Situatie
How to configure a new partition on a new disk for a dedicated server, or a virtual machine.
Solutie
The lsblk command with out any argument will print out the block devices in a tree format. Look for names, such as sda, sdb, etc. The top level denotes the disk and the first level children represent the partitions with in the block.
[root@OL4SAP001 DVD]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 50G 0 disk ├─sda1 8:1 0 1G 0 part /boot └─sda2 8:2 0 34G 0 part ├─vgroot00-root 249:0 0 30G 0 lvm / └─vgroot00-swap 249:1 0 4G 0 lvm [SWAP] ... sdf 8:80 0 15G 0 disk sdg 8:96 0 30G 0 disk sdh 8:112 0 20G 0 disk <--- note the disk sdi 8:128 0 50G 0 disk ... sdm 8:192 0 50G 0 disk └─vgoracleO19-lvoracleO19 249:5 0 25G 0 lvm /oracle/O19 sdn 8:208 0 30G 0 disk └─sdn1 8:209 0 30G 0 part /SOFTWARE/DVD/19c sr0 11:0 1 1024M 0 rom
Chose the disk and add 1 single partition for the entier size (disk)
[root@OL4SAP001 DVD]# fdisk /dev/sdh Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0xc561fdfe. Command (m for help): m <--- list the options for fdisk Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help): p <--- list the partition table Disk /dev/sdh: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0xc561fdfe Device Boot Start End Blocks Id System Command (m for help): n <--- new partition Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p <--- primary type Partition number (1-4, default 1): 1 <--- partition number First sector (2048-41943039, default 2048): <--- default if you want the partition to start from the beginning of the disk Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): <--- default if you want your disk to have one single big partition (complete disk) Using default value 41943039 Partition 1 of type Linux and of size 20 GiB is set Command (m for help): p <--- list again the partition table Disk /dev/sdh: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0xc561fdfe Device Boot Start End Blocks Id System /dev/sdh1 2048 41943039 20970496 83 Linux Command (m for help): w <--- write table to disk and exit The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@OL4SAP001 DVD]# fdisk -l /dev/sdh <--- check again the specific disk Disk /dev/sdh: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0xc561fdfe Device Boot Start End Blocks Id System /dev/sdh1 2048 41943039 20970496 83 Linux [root@OL4SAP001 DVD]#
Leave A Comment?