RHCSA Lec#5 Swap Partition

[root@localhost ~]# cd
[root@localhost ~]# swapon -s
Filename                Type        Size    Used    Priority
/dev/dm-1                                  partition    839676    0    -1
[root@localhost ~]# fdisk -l

Disk /dev/sda: 8589 MB, 8589934592 bytes, 16777216 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: 0x0001e70f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    16777215     7875584   8e  Linux LVM

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 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: 0x385d9e0f

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     1026047      512000   83  Linux
/dev/sdb2         1026048     2050047      512000   83  Linux

Disk /dev/sdc: 2147 MB, 2147483648 bytes, 4194304 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 /dev/mapper/rhel-root: 7201 MB, 7201619968 bytes, 14065664 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 /dev/mapper/rhel-swap: 859 MB, 859832320 bytes, 1679360 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

[root@localhost ~]# fdisk /dev/sdc
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 0x01d1a301.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-4194303, default 2048): 2048

Last sector, +sectors or +size{K,M,G} (2048-4194303, default 4194303): +1500M
Partition 1 of type Linux and of size 1.5 GiB is set

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 82
Changed type of partition 'Linux' to 'Linux swap / Solaris'

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (2-4, default 2): 2
First sector (3074048-4194303, default 3074048): 3074048
Last sector, +sectors or +size{K,M,G} (3074048-4194303, default 4194303): +512M
Partition 2 of type Linux and of size 512 MiB is set

Command (m for help): t
Partition number (1,2, default 2): 2
Hex code (type L to list all codes): 82
Changed type of partition 'Linux' to 'Linux swap / Solaris'

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# partprobe
[root@localhost ~]# mkswap /dev/sdc1
Setting up swapspace version 1, size = 1535996 KiB
no label, UUID=d9250325-05fd-40d4-9b77-6dd47668d064
[root@localhost ~]# gedit /etc/fstab
[root@localhost ~]# mkswap /dev/sdc2
Setting up swapspace version 1, size = 524284 KiB
no label, UUID=de957dd7-a557-47bc-8ccb-f67c70e0a294
[root@localhost ~]# gedit /etc/fstab
[root@localhost ~]# swapon /dev/sdc1

[root@localhost ~]# mount -a
[root@localhost ~]# swapon -s
Filename                Type        Size    Used    Priority
/dev/dm-1                                  partition    839676    0    -1
/dev/sdc1                                  partition    1535996    0    -2
[root@localhost ~]# swapon /dev/sdc2
[root@localhost ~]# swapon -s
Filename                Type        Size    Used    Priority
/dev/dm-1                                  partition    839676    0    -1
/dev/sdc1                                  partition    1535996    0    -2
/dev/sdc2                                  partition    524284    0    -3
[root@localhost ~]#

Comments

Popular Posts