- Google Cloud Platform for Architects
- Vitthal Srinivasan Janani Ravi Judy Raj
- 228字
- 2021-06-25 20:48:30
Linux procedure for formatting and mounting a persistent disk
Newly created persistent disks do not have any filesystems on them. We must format them with the desired filesystem and the number of partitions we need. Here, we will format it with a single partition and ext4 filesystem. To do so:
- Go to the VM instances page and access your instance through the browser using SSH.
- One you are prompted to the Terminal, use the lsblk command to list the attached disks to your instance:
sudo lsblk
- To format disks, use the make filesystem (mkfs) command. You can also make the runtime and formatting faster by means of optional arguments to disable lazy initialization:
sudo mkfs.ext4 -m 0 -F -E lazy_itable_init=0, lazy_journal_init=0, discard /dev/sda
- Now, to mount the formatted disk, create a directory that will serve as your mounting point:
sudo mkdir /mnt/my-mounting-dir
- Use the mount command and provide the disk and mounting point as arguments. Also make sure that the discard option is enabled:
sudo mount -o discard, defaults /dev/sda /mnt/my-mounting-dir
- You can also configure read and write permissions for users. We will provide write access to all users:
sudo chmod a+w /mnt/my-mounting-dir
Again, if you are attaching a persistent disk to your VM, the disk and the VM have to be in the same zone. Your VM instance and the persistent disk cannot be in different zones.
推薦閱讀
- 數據庫應用實戰
- iOS and OS X Network Programming Cookbook
- Python數據分析:基于Plotly的動態可視化繪圖
- Mastering Machine Learning with R(Second Edition)
- 從實踐中學習sqlmap數據庫注入測試
- 企業主數據管理實務
- Expert Python Programming(Third Edition)
- 數據挖掘競賽實戰:方法與案例
- 數據指標體系:構建方法與應用實踐
- 大數據測試技術:數據采集、分析與測試實踐(在線實驗+在線自測)
- 區塊鏈應用開發指南:業務場景剖析與實戰
- 精通Neo4j
- 一本書講透數據治理:戰略、方法、工具與實踐
- 大數據網絡傳播模型和算法
- 用戶畫像:平臺構建與業務實踐