mirror of
https://bitbucket.org/mangelo/snippets.git
synced 2024-11-22 02:41:00 +02:00
120 lines
4.6 KiB
Plaintext
120 lines
4.6 KiB
Plaintext
Xubuntu 16.04 with read only root filesystem for SSD disk
|
|
----------------------------------------------------------
|
|
|
|
* example:
|
|
/dev/sda: HDD disk (mechanical disk)
|
|
/dev/sdc: SSD disk (solid state disk)
|
|
|
|
/dev/sda2: /home /tmp /var/tmp
|
|
/dev/sda3: swap
|
|
/dev/sdc1: /
|
|
|
|
* install xubuntu 16.04 in /dev/sdc1.
|
|
|
|
* boot with xubuntu 16.04 in /dev/sdc1.
|
|
|
|
* mount /dev/sda2 /mnt
|
|
|
|
* mkdir /mnt/tmp ; chmod 1777 /mnt/tmp
|
|
|
|
* mkdir /mnt/home ; chmod 0755 /mnt/home
|
|
|
|
* mkdir -p /var/mounts/sda2 ; chmod 0755 /var/mounts/sda2
|
|
|
|
* mkdir -p /var/mounts/mediarw ; chmod 0755 /var/mounts/mediarw
|
|
|
|
* mkdir -p /var/mounts/mediaro ; chmod 0755 /var/mounts/mediaro
|
|
|
|
* mkdir -p /var/mounts/mediaro/share1 ; chmod 0755 /var/mounts/mediaro/share1
|
|
|
|
* mkdir -p /var/mounts/log ; chmod 0775 /var/mounts/log ; chown root.syslog /var/mounts/log
|
|
|
|
* mkdir -p /var/mounts/lightdm ; chmod 0755 /var/mounts/lightdm ; chown lightdm.lightdm /var/mounts/lightdm
|
|
|
|
* rsync -av /home/ /mnt/home/
|
|
|
|
* rm -fr /home/* ; rm -fr /home/.* <-- CAUTION!
|
|
|
|
* rm -fr /tmp/* ; rm -fr /tmp/.*
|
|
|
|
* rm -fr /var/tmp/* ; rm -fr /var/tmp/.*
|
|
|
|
* rm -fr /var/log/* ; rm -fr /var/log/.*
|
|
|
|
* rm -fr /var/spool/* ; rm -fr /var/spool/.*
|
|
|
|
* rm -fr /var/lib/blueman/* ; rm -fr /var/lib/blueman/.*
|
|
|
|
* rm -fr /var/lib/lightdm/* ; rm -fr /var/lib/lightdm/.*
|
|
|
|
* rm -fr /var/lib/lightdm-data/* ; rm -fr /var/lib/lightdm-data/.*
|
|
|
|
* /etc/fstab
|
|
#--- root & swap ---
|
|
UUID=[UUID-SDC1] / ext4 ro,noatime,errors=remount-ro 0 1
|
|
UUID=[UUID-SDA3] none swap sw 0 0
|
|
|
|
#--- home & tmp ---
|
|
UUID=[UUID-SDA2] /var/mounts/sda2 ext4 rw,noatime,errors=remount-ro,x-systemd.requires=/ 0 1
|
|
/var/mounts/sda2/home /home none bind,x-systemd.requires=/var/mounts/sda2 0 0
|
|
/var/mounts/sda2/tmp /tmp none bind,x-systemd.requires=/var/mounts/sda2 0 0
|
|
/var/mounts/sda2/tmp /var/tmp none bind,x-systemd.requires=/var/mounts/sda2 0 0
|
|
|
|
#--- logs ---
|
|
tmpfs /var/mounts/log tmpfs rw,nosuid,nodev,noatime,mode=0777,size=8M,uid=root,gid=syslog,x-systemd.requires=/ 0 0
|
|
/var/mounts/log /var/log none bind,x-systemd.requires=/var/mounts/log 0 0
|
|
/var/mounts/log /var/spool none bind,x-systemd.requires=/var/mounts/log 0 0
|
|
/var/mounts/log /var/lib/blueman none bind,x-systemd.requires=/var/mounts/log 0 0
|
|
|
|
#--- lightdm ---
|
|
tmpfs /var/mounts/lightdm tmpfs rw,nosuid,nodev,noatime,mode=0755,size=1M,uid=lightdm,gid=lightdm,x-systemd.requires=/ 0 0
|
|
/var/mounts/lightdm /var/lib/lightdm none bind,x-systemd.requires=/var/mounts/lightdm 0 0
|
|
/var/mounts/lightdm /var/lib/lightdm-data none bind,x-systemd.requires=/var/mounts/lightdm 0 0
|
|
|
|
#--- media ---
|
|
tmpfs /var/mounts/mediarw tmpfs rw,nosuid,nodev,noatime,mode=0755,size=1M,uid=root,gid=root,x-systemd.requires=/ 0 0
|
|
aufs /media aufs rw,noatime,br=/var/mounts/mediarw=rw:/var/mounts/mediaro=ro,udba=reval,x-systemd.requires=/var/mounts/mediarw 0 0
|
|
|
|
#--- shares ---
|
|
[NFSSERVER]:/path/to/nfs/share1 /media/share1 nfs _netdev,rw,noauto,user,users,noexec,nosuid,nolock,noatime,nfsvers=3,sec=sys,udp,rsize=32768,wsize=32768 0 0
|
|
|
|
* /etc/default/grub
|
|
GRUB_TIMEOUT=N
|
|
GRUB_RECORDFAIL_TIMEOUT=$GRUB_TIMEOUT
|
|
update-grub
|
|
|
|
* /usr/local/bin/remountrw + chmod 744
|
|
mount -o remount,rw /
|
|
|
|
* /usr/local/bin/remountro + chmod 744
|
|
sync
|
|
sleep 1
|
|
mount -o remount,ro /
|
|
|
|
* Network Manager: wired connection with fixed IP address:
|
|
"/etc/NetworkManager/system-connections/Wired Connection" + chmod 600
|
|
|
|
[ethernet]
|
|
duplex=full
|
|
mac-address=xx:xx:xx:xx:xx:xx
|
|
|
|
[connection]
|
|
id=Wired Connection
|
|
uuid=66b010e7-d2b0-4e5a-a2d8-f1d8191a241d
|
|
type=ethernet
|
|
timestamp=1440124541
|
|
|
|
[ipv6]
|
|
method=auto
|
|
ip6-privacy=0
|
|
|
|
[ipv4]
|
|
method=manual
|
|
dns=<IP_ADDRESS>;
|
|
address1=<IP_ADDRESS>/<MASK 0-30>,<DEFAULT_GATEWAY>
|
|
may-fail=false
|
|
|
|
* Issues:
|
|
* The guest session not work: /etc/password and /etc/shadow are read only.
|
|
* Lightdm can not remember the last user logged.
|