L'ardoise eduvax

Blog, free software projects, computer tips and more

linux tips

Dump and restore full file system

Written by Sebastien Devaux - - no comments

Tar and other file archiver may miss some specific file attributes and special files. At least for ext2/3/4 file systems, old fashion BSD dump and restore utilities (debian package simply named dump) remains a perfect solution to backup an entire file system. The following procedure may help to move a filesystem from a disk to another.

  • backup root filesystem to a file. Beware! Avoid to put the backup file on the filesystem to be dumped:
# dump -0z -f /mnt/backup/rootfs.dump.gz
  • to restore the filesystem, first create a new fresh partition and empty file system (fdisk + mkfs). Then use restore command to unpack the dump file into the new file system.
# cd /mnt/newfs
# restore -f /mnt/backup/rootfs.dump.gz

Read more Dump and restore full file system

Mount MTP USB device

Written by Sebastien Devaux - - no comments

Since mass storage device is not always available, exchange files using MTP becomes mandatory.

  • 1st, install jmtpfs package or simular (mtpfs, go-mtpfs). fuse is needed.
  • add users that need to mount such device to the fuse group.
  • create a new directory that will be used as mount point (for instance ~/mtpdev).
  • For each file exchange session:
    • plug your USB device (beware, connection some android phone will fail if in standby mode, unlock your device first).
    • mount device: $ jmtpfs ~/mtpdev
    • do wathever you want on the mounted file system (unfortunately, much slower than any mass storage device).
    • Once all exchanges are completed, unmount file system: $ fuser -u ~/mtpdev
    • The device is ready to unplug.

Read more Mount MTP USB device

Use an android phone as internet gateway

Written by Sebastien Devaux - - no comments

  • Plug through USB the phone to the linux host.
  • Share the connexion on the phone : go to parameters / More / connexion sharing / USB (may be not exact item labels, my phone runs a french cyanogenmod).
  • setup the net usb interface on the linux host :
  • $ modprobe usbnet
    $ ifconfig usb0 up
    $ dhclient usb0

    Read more Use an android phone as internet gateway