- 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.
推薦閱讀
- 數據存儲架構與技術
- Python絕技:運用Python成為頂級數據工程師
- 信息系統與數據科學
- Access 2007數據庫應用上機指導與練習
- 工業大數據分析算法實戰
- R數據科學實戰:工具詳解與案例分析(鮮讀版)
- Lean Mobile App Development
- WS-BPEL 2.0 Beginner's Guide
- The Game Jam Survival Guide
- 數字媒體交互設計(初級):Web產品交互設計方法與案例
- Proxmox VE超融合集群實踐真傳
- 計算機應用基礎教程上機指導與習題集(微課版)
- PostgreSQL指南:內幕探索
- 視覺大數據智能分析算法實戰
- Power BI智能數據分析與可視化從入門到精通