df only displays mounted file systems.
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 16G 4.0G 12G 26% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 394M 960K 393M 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda15 105M 9.2M 96M 9% /boot/efi
/dev/loop0 56M 56M 0 100% /snap/core18/1932
/dev/loop1 56M 56M 0 100% /snap/core18/1944
/dev/loop2 130M 130M 0 100% /snap/google-cloud-sdk/161
/dev/loop3 130M 130M 0 100% /snap/google-cloud-sdk/162
/dev/loop4 71M 71M 0 100% /snap/lxd/16922
/dev/loop5 68M 68M 0 100% /snap/lxd/18150
/dev/loop6 32M 32M 0 100% /snap/snapd/10238
/dev/loop7 32M 32M 0 100% /snap/snapd/10492
tmpfs 394M 0 394M 0% /run/user/1005
In GCP, the name of the disk is written at the end. (In this example, sdb is a newly created disk.)
ll /dev/disk/by-id
lrwxrwxrwx 1 root root 9 Jan 11 16:46 scsi-0Google_PersistentDisk_mysql-2-backup -> ../../sdb
List currently available block devices.
$ sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 55.3M 1 loop /snap/core18/1885
loop1 7:1 0 128.8M 1 loop /snap/google-cloud-sdk/160
loop3 7:3 0 70.6M 1 loop /snap/lxd/16922
loop4 7:4 0 55.4M 1 loop /snap/core18/1932
loop5 7:5 0 128.8M 1 loop /snap/google-cloud-sdk/159
loop6 7:6 0 31M 1 loop /snap/snapd/9607
loop7 7:7 0 31M 1 loop /snap/snapd/9721
loop8 7:8 0 67.8M 1 loop /snap/lxd/18150
sda 8:0 0 16G 0 disk
├─sda1 8:1 0 15.9G 0 part /
├─sda14 8:14 0 4M 0 part
└─sda15 8:15 0 106M 0 part /boot/efi
sdb 8:16 0 16G 0 disk
mkfs.ext4 -F -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/disk/by-id/scsi-0Google_PersistentDisk_mysql-2-backup
# mkfs.ext4 -F -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/disk/by-id/scsi-0Google_PersistentDisk_mysql-2-backup
mke2fs 1.45.5 (07-Jan-2020)
Discarding device blocks: done
Creating filesystem with 4194304 4k blocks and 1048576 inodes
Filesystem UUID: a9b02fa8-593b-4ee4-9764-0bff20b8b558
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
mount
$ mkdir -p /mnt/mysql-2-backup
$ mount -o discard,defaults /dev/disk/by-id/scsi-0Google_PersistentDisk_mysql-2-backup /mnt/mysql-2-backup
Add the following to / etc/fstab
/dev/disk/by-id/scsi-0Google_PersistentDisk_mysql-2-backup /mnt/mysql-2-backup ext4 defaults 1 1
chmod a+w /mnt/mysql-2-backup
cp /etc/fstab /etc/fstab.backup
sdb is increasing.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 16G 3.7G 12G 24% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 394M 960K 393M 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda15 105M 9.2M 96M 9% /boot/efi
/dev/loop0 56M 56M 0 100% /snap/core18/1932
/dev/loop1 56M 56M 0 100% /snap/core18/1944
/dev/loop2 130M 130M 0 100% /snap/google-cloud-sdk/161
/dev/loop3 130M 130M 0 100% /snap/google-cloud-sdk/162
/dev/loop4 71M 71M 0 100% /snap/lxd/16922
/dev/loop5 68M 68M 0 100% /snap/lxd/18150
/dev/loop6 32M 32M 0 100% /snap/snapd/10238
/dev/loop7 32M 32M 0 100% /snap/snapd/10492
tmpfs 394M 0 394M 0% /run/user/1005
/dev/sdb 16G 45M 15G 1% /mnt/mysql-2-backup
Recommended Posts