3-1 [Configure Local Storage] Partitions on MBR and GPT Disks Flashcards
fdisk
Used to create master boot record-based partitions
gdisk
Used to create GPT-based partitions
MBR
disk can be only up to 2 TB in size as that is partition’s max
only 4 primary partitions
GPT
Means GUID Partiton table
because every partition has its own GUID associated
disk can be parted up to 128 partitions (no need for distinguishing between primary, extended, and logical partitions) 8 zebibyte (which is a lot) per partition
dd if=/dev/xvda of=/root/diskfilename bs=1M count=1
cp /etc/fstab /root/fstabcopy
Easy to revert to initial disk, after using it for practice
save first megabyte of raw blocks as a new file
make a copy of fstab
fdisk /dev/xvda
p to see avalable space
n for new partition
p for primary partition or pick diff (e for extended partition, used to make logical partition)
enter to accept defaults
+number(with K, M, or G) for partition size
decide, linux, linux swap, linux lvm
update in-memory kernel table: for it to take effect
partprobe /dev/xvda
how to make mbr partition
fdisk -l
list MBR partitions
echo $?
check if last command exited successfully
successful if 0 is returned
what is command
partprobe /dev/xvda
Is a program that informs the operating system kernel of partition table changes, by requesting that the operating system re-read the partition table
fdisk
Sector default begins at 2048
MBR
Space is saved for mbr records in order to maintain information about the disks
fdisk
option: l (lowercase L)
MBR
list known partition types
fdisk
option: w
changes down in fdisk don’t exist until saved
fdisk
option: l
option: t
enter code looked up by option l(lowercase L)
change partition id (essentially label)
mkfs -t xfs /dev/xvda
after partitioning,
make filesystem next with mkfs -t FILESYSTEM(ex: xfs ext4)
-t to set file type (xfs,ext4 etc)
df -h
see all mounted disk devices
blkid
see available block storage devices attached to system
/mnt
directory and its subdirectories are intended for use as the temporary mount points for mounting storage devices
mkdir newdir inside /mnt
mount /dev/xvda /mnt/newdir
mount device
fdisk
option: d
delete partiton, referred to by which partition number
blkid
mount -U uuid(gathered from blkid) /mnt/newdir
mount by UUID
two tools to make GPT partitons
command parted
command gdisk , easier to use for cert exam than parted
gdisk
option: ?
option: n
option: w
afterwards for filesystem:
mkfs -t xfs /dev/xvda
used for GPT partitons
list options
new partition
save changes
afterwards make file system using mkfs -t
mount and use df -h to check
umount /dev/xvda
gdisk /dev/xvda
option: d
option: w
to delete GPT partition