LABEL=/12 / ext4 defaults 1 1 LABEL=/home /home ext4 defaults 1 2 LABEL=/boot /boot ext4 defaults 1 2 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 LABEL=SWAP-sda3 swap swap defaults 0 0
段号 | 内容 | 说明 |
---|---|---|
1 | 设备 | 传统上,此字段包含与物理设备关联的设备文件的实际名称,例如/dev/sda1(第一个检测到的硬盘的第一个分区)。 但当代计算机上,有许多可热插拔的设备(如USB驱动器),许多现代Linux发行版将设备与文件标签关联起来。 该标签(格式化后添加到存储介质中)可以是简单的文本标签,也可以是随机生成的UUID(Universally Unique Identifier,通用唯一标识符)。 当设备连接到系统是,操作系统会读取此标签。这样,无论哪个设备文件被分配给实际的物理设备,它仍然可以被正确识别。 |
2 | 挂载点 | 设备附加到文件系统树的目录。 |
3 | 文件系统类型 | 大多数本机Linux文件系统是第四扩展文件系统(Fourth Extended File System,ext4)。 还支持其他文件系统,比如FAT16(msdos)、FAT32(vfat)、NTFS、CD-ROM(iso9660)等。 |
4 | 选项 | 文件系统可以通过各种选项挂载。 例如,可以将文件系统挂载为只读,或防止任何程序从文件系统执行(这是可移动媒体的一个有用的安全功能能)。 |
5 | 频率 | 指定是否可以以及何时使用dump命令备份文件系统的单个数字。 |
6 | 顺序 | 指定使用fsck命令检查文件系统的顺序 |
[me@linuxbox ~]$ mount /dev/sda2 on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/sda5 on /home type ext4 (rw) /dev/sda1 on /boot type ext4 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) fusectl on /sys/fs/fuse/connections type fusectl (rw) /dev/sdd1 on /media/disk type vfat (rw,nosuid,nodev,noatime,uhelper=hal,uid=500,utf8,shortname=lower) twin4:/musicbox on /misc/musicbox type nfs4 (rw,addr=192.168.1.4)
[me@linuxbox ~]$ mount /dev/mapper/VolGroup00-LogVol00 on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/sda1 on /boot type ext4 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
[me@linuxbox ~]$ mount /dev/mapper/VolGroup00-LogVol00 on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/hda1 on /boot type ext4 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) /dev/sdc on /media/live-1.0.10-8 type iso9660 (ro,noexec,nosuid,nodev,uid=500)
样式 | 设备 |
---|---|
/dev/fd* | 软盘设备 |
/dev/hd* | 旧系统上的IDE(PATA)硬盘。 |
/dev/lp* | 打印机 |
/dev/sd* | SCSI磁盘( 当代Linux系统内核将所有类似磁盘的设备(如硬盘、U盘和移动硬盘、MP3和数码相机等)都视为SCSI磁盘。 插在第一个SATA口上的硬盘被命名为hda、第二个口上的为hdb,依次类推。后面跟数字表示第几个分区。 如/dev/sda1表示插在第一个SATA口上的磁盘的第一个分区。( |
/dev/sr* | 光驱 |
Jul 23 10:07:53 linuxbox kernel: usb 3-2: new full speed USB device using uhci_hcd and address 2 Jul 23 10:07:53 linuxbox kernel: usb 3-2: configuration #1 chosen from 1 choice Jul 23 10:07:53 linuxbox kernel: scsi3 : SCSI emulation for USB Mass Storage devices Jul 23 10:07:58 linuxbox kernel: scsi scan: INQUIRY result too short (5), using 36 Jul 23 10:07:58 linuxbox kernel: scsi 3:0:0:0: Direct-Access Easy Disk 1.00 PQ: 0 ANSI: 2 Jul 23 10:07:59 linuxbox kernel: sd 3:0:0:0: [sdb] 31263 512-byte hardware sectors (16 MB) Jul 23 10:07:59 linuxbox kernel: sd 3:0:0:0: [sdb] Write Protect is off Jul 23 10:07:59 linuxbox kernel: sd 3:0:0:0: [sdb] Assuming drive cache: write through Jul 23 10:07:59 linuxbox kernel: sd 3:0:0:0: [sdb] 31263 512-byte hardware sectors (16 MB) Jul 23 10:07:59 linuxbox kernel: sd 3:0:0:0: [sdb] Write Protect is off Jul 23 10:07:59 linuxbox kernel: sd 3:0:0:0: [sdb] Assuming drive cache: write through Jul 23 10:07:59 linuxbox kernel: sdb: sdb1 Jul 23 10:07:59 linuxbox kernel: sd 3:0:0:0: [sdb] Attached SCSI removable disk Jul 23 10:07:59 linuxbox kernel: sd 3:0:0:0: Attached scsi generic sg3 type 0
Jul 23 10:07:59 linuxbox kernel: sdb: sdb1 Jul 23 10:07:59 linuxbox kernel: sd 3:0:0:0: [sdb] Attached SCSI removable disk
[me@linuxbox ~]$ sudo mkdir /mnt/flash [me@linuxbox ~]$ sudo mount /dev/sdb1 /mnt/flash [me@linuxbox ~]$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda2 15115452 5186944 9775164 35% / /dev/sda5 59631908 31777376 24776480 57% /home /dev/sda1 147764 17277 122858 13% /boot tmpfs 776808 0 776808 0% /dev/shm /dev/sdb1 15560 0 15560 0% /mnt/flash
Command action a toggle a bootable flag切换可引导标志 b edit bsd disklabel编辑bsd磁盘标签 c toggle the dos compatibility flag切换dos兼容性标志 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创建一个新的空DOS分区表 p print the partition table显示分区表 q quit without saving changes退出,不保存 s create a new empty Sun disklabel创建一个新的空Sun磁盘标签 t change a partition's system id变更分区的系统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): p Disk /dev/sdb: 16 MB, 16006656 bytes 1 heads, 31 sectors/track, 1008 cylinders Units = cylinders of 31 * 512 = 15872 bytes Device Boot Start End Blocks Id System /dev/sdb1 2 1008 15608+ b W95 FAT32
Command (m for help): t Selected partition 1 Hex code (type L to list codes): 83 Changed system type of partition 1 to 83 (Linux)
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information. Syncing disks. [me@linuxbox ~]$
[me@linuxbox ~]$ sudo mkfs -t ext4 /dev/sdb1 mke2fs 2.23.2 (12-Jul-2011) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 3904 inodes, 15608 blocks 780 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=15990784 2 block groups 8192 blocks per group, 8192 fragments per group 1952 inodes per group Superblock backups stored on blocks: 8193 Writing inode tables: done Creating journal (1024 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 34 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [me@linuxbox ~]$
[me@linuxbox ~]$ sudo fsck /dev/sdb1 fsck 1.40.8 (13-Mar-2016) e2fsck 1.40.8 (13-Mar-2016) /dev/sdb1: clean, 11/3904 files, 1661/15608 blocks