# Create users and groups addgroup clippy && adduser --ingroup clippy win addgroup tux && adduser --ingroup tux lin addgroup apple && adduser --ingroup apple mac # View groups: getent group clippy #ID: getent group tux #ID: getent group apple #ID: # Create folders mkdir -p /var/research/windows /var/research/linux /var/research/mac # Change permissions: writable only for group chmod 070 /var/research/windows /var/research/linux /var/research/mac # Change groups chgrp clippy /var/research/windows chgrp tux /var/research/linux chgrp apple /var/research/mac # Managing disks # What we have in system lsblk # Also check file systems lsblk -f # Choose disks cfdisk /dev/sdb -> /var/research/windows cfdisk /dev/sdc -> /var/research/linux cfdisk /dev/sdd -> /var/research/mac cfdisk /dev/sde -> swap # whenever needed, please use partition table sync with kernel: partprobe /dev/sdb # for more reading: http://www.computerhope.com/unix/partprob.htm # Make file systems: mkfs.ntfs -Q /dev/sdb1 #-Q quick format mkfs.ext4 /dev/sdc1 mkfs.hfsplus /dev/sdd1 # Make swap area: mkswap /dev/sde1 # Older machines do not support dos (mbr) type of partition table # To get UUID into /etc/fstab file, please make a backup in first place: cp /etc/fstab /etc/fstab-copy blkid | grep >> /etc/fstab # Add UUID's to /etc/fstab: blkid | grep ntfs >> /etc/fstab blkid | grep hfsplus >> /etc/fstab blkid | grep swap | grep sde >> /etc/fstab # Write appropriate entrys into /etc/fstab to mount them at system startup (also fix previously added lines with blkid): nano /etc/fstab ...... UUID= /var/research/windows ntfs-3g gid=1003,umask=0707 0 0 UUID= /var/research/linux ext4 defaults 0 0 UUID= /var/research/mac hfsplus gid=1005,umask=0707 0 0 UUID= none swap sw 0 0 # For checking /etc/fstab syntax and mount created filesystems (please do this BEFORE reboot the system): mount -a #will mount all in /etc/fstab described file systems that are not yet mounted swapon -a #will mount all in /etc/fstab described swap entrys that are not yet mounted # Change groups also AFTER mounting file systems chgrp clippy /var/research/windows chgrp tux /var/research/linux chgrp apple /var/research/mac # Also change folder permissions AFTER mounting file systems: chmod 070 /var/research/windows /var/research/linux /var/research/mac # Unmounting file systems: umount (or partition, e.g. /dev/sdb1) .... # You can unmount also multiple mount points at once umount /var/research/windows /var/research/linux /var/research/mac # What is mounted: mount | column -t #will show all mounted file systems mount -t ext4 #shows only mounted ext4 file systems mount -t fuseblk #shows only mounted ntfs file systems mount -t hfsplus #shows only mounted hfsplus file systems df -h #shows free disk space and also mount points # More about /etc/fstab https://help.ubuntu.com/community/Fstab # macOS HFS+ https://help.ubuntu.com/community/hfsplus https://askubuntu.com/questions/332315/how-to-read-and-write-hfs-journaled-external-hdd-in-ubuntu-without-access-to-os https://askubuntu.com/questions/714545/cannot-mount-hfs-partition-on-read-write sudo apt update && sudo apt-get install hfsprogs && sudo apt clean # NTFS-3G https://help.ubuntu.com/community/MountingWindowsPartitions https://wiki.archlinux.org/index.php/NTFS-3G UUID=519CB82E5888AD0F /media/Data ntfs-3g defaults,windows_names,locale=et_EE.utf8 0 0 # ext4 man mount /ext4 #search Mount options for ext4 #title in man page