mirror of
https://github.com/chubin/cheat.sheets
synced 2024-11-17 09:25:32 +00:00
adding to fdisk cheatsheet
This commit is contained in:
parent
ffae74cdfd
commit
a8ca925b2e
55
sheets/fdisk
55
sheets/fdisk
@ -6,3 +6,58 @@ fdisk /dev/sda
|
||||
Command (m for help): d
|
||||
Partition number (1-9): XXX
|
||||
|
||||
# Usage:
|
||||
fdisk [options] <disk> change partition table
|
||||
fdisk [options] -l <disk> list partition table(s)
|
||||
fdisk -s <partition> give partition size(s) in blocks
|
||||
|
||||
# Options:
|
||||
-b <size> sector size (512, 1024, 2048 or 4096)
|
||||
-c[=<mode>] compatible mode: 'dos' or 'nondos' (default)
|
||||
-h print this help text
|
||||
-u[=<unit>] display units: 'cylinders' or 'sectors' (default)
|
||||
-v print program version
|
||||
-C <number> specify the number of cylinders
|
||||
-H <number> specify the number of heads
|
||||
-S <number> specify the number of sectors per track
|
||||
|
||||
# To display partition table
|
||||
p
|
||||
|
||||
# To delete a partition
|
||||
d
|
||||
|
||||
# To display a list of partition types
|
||||
l or L
|
||||
|
||||
# To create a new partition
|
||||
n
|
||||
|
||||
# To change the type of a partition
|
||||
t
|
||||
|
||||
# To write changes to fdisk
|
||||
w
|
||||
|
||||
# Adding a new physical disk
|
||||
lsblk
|
||||
fdisk /dev/sdd
|
||||
|
||||
# create new partition in fdisk
|
||||
mkfs.xfs /dev/sdd1
|
||||
blkid /dev/sdd1
|
||||
|
||||
# edit /etc/fstab
|
||||
UUID=<blkid#> /opt defaults 0 0 # 00 disable disk checking and metadata dumping
|
||||
mount -a
|
||||
df -h /opt
|
||||
|
||||
# Extending a physical disk (vm)
|
||||
1. Unmount drive - comment out /etc/fstab entry for /dev/sdc
|
||||
2. Increase drive physical space
|
||||
3. parted /dev/sdc - 'p' #print partitions on /dev/sdc
|
||||
4. fdisk /dev/sdc - 'p' - 'd' - 'n' (defaults) - w # delete old partition, create new partition
|
||||
5. reboot
|
||||
6. e2fsck -f /dev/sdc1
|
||||
7. resize2fs /dev/sdc1
|
||||
8. mount /dev/sdc1 - uncomment fstab
|
Loading…
Reference in New Issue
Block a user