1 查看所有的磁盘
sudo fdisk -l |more
2 设置磁盘
sudo fdisk /dev/sdb
-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u') WARNING : DOS Command (m for help):c <enter> DOS Compatibility flag is not set (不兼容DOS的模式,如果不用这个模式不能把硬盘设置成1T以上的) Command (m for help): m <enter> Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help):n <enter> Command action e extended p primary partition (1-4) p <enter> Partition number (1-4): 1 <enter> Command (m for help):w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
3 格式化硬盘
sudo mke2fs -t ext3 /dev/sdb1
4 自动挂载
sudo nano /etc/fstab
加入以下信息
/dev/sdb1 /mnt/kfs ext3 defaults 0 2
注意挂盘的时候一定要挂自己建立的文件目录,这样才可以很随意的换硬盘
二 修复了Ubuntu 变成了只读文件系统的错误
发现修改/etc/fstab,提示只读文件系统,:w!也失败。
运行以下语句即可
mount /dev/sda1 / -o rw,remount
三 SSH 配置互通
只需修改 authorized_keys 的IP 为 192.168.1.*即可达到通配的效果