# # # To Remount the /dev/loop devices as rw # --------------------------------------- # Invoke this script from console, without X11 running # # # 06-Sep-05 amo Date-of-Birth # 07-Sep-05 amo Use $LOOP for loop1 or loop2 # # # /dev/loop /dev/sda # --------- -------- # loop1 sda3 /usr/X11R6 # loop2 sda5 /opt/kde # LOOP="$1" # # # Exit on error # ------------- function cmd { cmd="$1" # echo "$1" eval "$cmd" # if [ $? != 0 ]; then echo "#" echo "# Aborting" echo "#" # exit 1 # fi # } # # function Usage { # echo "#" echo "# usage $0 < loop1 | loop2 > " echo "#" # exit 1 # } # Usage # # if [ "$LOOP" = "loop1" ]; then SDA="sda3" elif [ "$LOOP" = "loop2" ]; then SDA="sda5" else Usage fi # # See that its read-only # ----------------------- touch /mnt/$LOOP/read-write.tst # # # Unmount the loop devices # ------------------------ cmd "umount /mnt/$LOOP" cmd "losetup -d /dev/$LOOP" cmd "umount /mnt/$SDA" sync # # # Mount as RW # ----------- # cmd "mount /dev/$SDA /mnt/$SDA" cmd "losetup /dev/$LOOP /mnt/$SDA/LoopFile" cmd "mount /dev/$LOOP /mnt/$LOOP" sync # # # Now it is read-write # -------------------- touch /mnt/$LOOP/read-write.tst # # # End of file