Suggested Answer:See explanation below.
# fdisk /dev/sda p (check Partition table) n (create new partition: press e to create extended partition, press p to create the main partition, and the extended partition is further divided into logical partitions)
Enter - +2G t l
W - partx -a /dev/sda partprobe mkswap /dev/sda8
Copy UUID - swapon -a vim /etc/fstab UUID=XXXXX swap swap defaults 0 0 (swapon -s)
create a partition for given size(2G)
#fdisk /dev/sdb
#n
#+2G
#w
#partprobe
check the present free memory
#free -h
#mkswap /dev/sdb5
#swapon /dev/sdb5
check the swap space and compai with privious value
#free -h
exit /etc/fstab and add below line
/dev/sdb5 swap swap defaults 0 0
wright and exit /etc fstab
# swapon -a
lsblk #to check partition
fdisk /dev/sdb #to sda or sdb depending on the disk
n # for new
p #primary
1 #default partition number
enter #first sector
+2G #last sector
t #to change type and select 82 for swap
82 #code for hex
w #save changes
partprobe #to update partition table
lsblk #to confirm
mkswap /dev/sbd1 #to generate UUID, we need UUID to make it permanent
lsblk -f #to see file system, should be swap
vi /etc/fstab #to make it permanent
UUID=xxxxxxxxxxxx swap swap defaults 0 0
free -h
swapon -a
free -h #swap value must be increased by 2G
blkid is a good comand to know partition UUID but with your command literally the swap partition dont start at boot time
upvoted 1 times
...
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
cloudyhr
Highly Voted 2 years, 10 months agoRahul95
Highly Voted 1 year, 5 months agosagusugar
Most Recent 3 months agotylerw6
6 months, 2 weeks agoertgrty
1 year, 2 months agoktd971
1 year, 9 months agoktd971
1 year, 9 months agoBrabus
1 year, 11 months agoStunomatic
1 year, 11 months agomemonic
1 year, 10 months ago