ssfs rev 15
ssf-server: Add check-vdisk to check vdisk filesystem
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Jun 11 23:11:23 2011 +0200 (2011-06-11) |
parents | 048464223866 |
children | 67d7208aaab3 |
files | data/ssfs-server.conf ssfs-server |
line diff
1.1 --- a/data/ssfs-server.conf Sat Jun 11 22:31:07 2011 +0200 1.2 +++ b/data/ssfs-server.conf Sat Jun 11 23:11:23 2011 +0200 1.3 @@ -5,10 +5,10 @@ 1.4 SSFS_CHROOT="/ssfs" 1.5 1.6 # Path to Ssfs virtual disk. 1.7 -SSFS_VDISK="/home/ssfs.ext3" 1.8 +SSFS_VDISK="/home/ssfs.disk" 1.9 1.10 # Virtual disk size in Gb. 1.11 -SSFS_SIZE="10" 1.12 +SSFS_SIZE="4" 1.13 1.14 # User configuration file path. 1.15 SSFS_USERS="/etc/ssfs/users"
2.1 --- a/ssfs-server Sat Jun 11 22:31:07 2011 +0200 2.2 +++ b/ssfs-server Sat Jun 11 23:11:23 2011 +0200 2.3 @@ -57,6 +57,7 @@ 2.4 chroot $(gettext "Chroot to Ssfs storage root.") 2.5 gen-vdisk $(gettext "Create a vdisk with chroot for files storage.") 2.6 clean-vdisk $(gettext "Clean the vdisk but skip home and root.") 2.7 + check-vdisk $(gettext "Check vdisk filesystem with e2fsck.") 2.8 mount-vdisk $(gettext "Mount ssfs virtual disk.") 2.9 umount-vdisk $(gettext "Unmount the vdisk and free loop device.") 2.10 2.11 @@ -122,10 +123,14 @@ 2.12 } 2.13 2.14 mount_vdisk() { 2.15 - umount_vdisk 2.16 - [ -d "$root" ] || mkdir -p $root 2.17 - gettext "Mounting virtual disk:"; echo " $vdisk $root" 2.18 - mount -o loop -t ext3 $vdisk $root 2.19 + if ! mount | fgrep -q $root; then 2.20 + [ -d "$root" ] || mkdir -p $root 2.21 + gettext "Mounting virtual disk:" 2.22 + mount -o loop -t ext3 $vdisk $root 2.23 + else 2.24 + gettext "Ssfs vdisk is already mounted:" 2.25 + fi 2.26 + echo " $vdisk $root" 2.27 } 2.28 2.29 # 2.30 @@ -165,7 +170,7 @@ 2.31 2.32 # We don't want any files from /etc/skel. 2.33 gettext "Cleaning home and creating: Sync/..." 2.34 - rm -rf $home && mkdir -p $home/Sync && status 2.35 + rm -rf $home && mkdir -p $home/Sync $home/.ssh && status 2.36 gettext "Changing mode on user home: 0700..." 2.37 chown -R $login.$login $home 2.38 chmod 0700 $home && status 2.39 @@ -260,6 +265,19 @@ 2.40 mount_vdisk ;; 2.41 umount-vdisk) 2.42 umount_vdisk ;; 2.43 + check-vdisk) 2.44 + # Check vdisk with e2fsck. 2.45 + echo "" 2.46 + gettext -e "Checking Ssfs virtual disk\n" 2.47 + separator 2.48 + gettext "Virtual disk : "; du -sh $vdisk 2.49 + gettext "Filesystem usage : "; du -sh $root 2.50 + gettext "Remounting vdisk read/only before e2fsck -p..." 2.51 + mount -o remount,loop,ro $vdisk $root && status 2.52 + e2fsck -p $vdisk 2.53 + gettext "Remounting vdisk read/write..." 2.54 + mount -o remount,loop,rw $vdisk $root && status 2.55 + separator && echo "" ;; 2.56 clean-vdisk) 2.57 # clean up the vdisk storage chroot. 2.58 if [ ! -d "$root/bin" ] || [ ! -d "$root/usr" ]; then