Re-install GRUB
...Add a new disk
...Migrate data to a SSD disk
...List partitions
...Format or mount FAT32 partitions
...List mounted file systems


With Grub2, you should not be edition /boot/grub/grub.cfg, because eventually it will be overwritten. So, as much as possible, don't touch the file. To parse OS on disks and build the GRUB menu:
$ sudo update-grub2
To install GRUB on a partition:
$ sudo grub-install /dev/sda
Note that usually you install at the beginning of a disk, and not on a partition. So, it's /dev/sda, not /dev/sda1 or /dev/sda2 etc. To know where grub is installed:
$ sudo grub-probe -t device /boot/grub
To get the version of grub:
$ grub-install --version

Removing the quiet splash screen

I like to see the system logs when I boot: Edit /etc/default/grub and modify the GRUB_CMDLINE_LINUX_DEFAULT to remove quiet splash.
Then do

Re-install GRUB

To re-install GRUB:
  • boot on the host, mount disks and find /usr/sbin/grub
  • launch /usr/sbin/grub:
root (hd0,1)
or find /boot/grub/stage1
setup (hd0)
Or, from a Live CD, mount the partition to boot on, then:
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/temp$i;  done
chroot /mnt/temp
grub-install --root-directory=/mnt/temp /dev/sda

The setup line actually resets the MBR. Of course, another way to do that is to copy back the MBR (using dd).


Add a new disk

  • Backup your system, Poweroff, connect the new disk
  • Boot: if necessary enable the slot for the disk in the BIOS (SATA drive...)
  • Partition the new disk with the Gnome's disk utility (gnome-disk-utility): /usr/bin/palimpsest
  • Mount the new disk (manually), move data around (better to perform a copy if sensitive)
  • If everything is okay, configure /etc/fstab to mount the partition automatically

Migrate data to a SSD disk

This is how to migrate data to a (fast) SSD disk.
  • Create partitions on the SSD disk, using for instance a tool such as gparted
  • Copy your old partitions to the new SSD disk. It is possible to use a tool such as clonezilla, but a "dd" or a "cp -afv" will do magic too ;)
    • use cp -afv if you need to copy selectively files on your old disk. Make sure to use the "-a" option so that for instance setuid bits are preserved.
    • dd is particularly useful to copy superblocks at the beginning of a partition etc
      sudo dd if=./superblock-sdb1 of=/dev/sdb1 bs=512 count=1
      1+0 records in
      1+0 records out
      512 bytes (512 B) copied, 0,000500107 s, 1,0 MB/s
    • clonezilla exists on a Live CD and is useful to copy root partitions (wouldn't be possible if the partition is used by the OS)
  • from a live CD, mount all partitions for the new SSD:
    mount /dev/the-ssd-partition /mnt/point
    mount --bind /dev /mnt/dev
    mount --bind /proc /mnt/proc
    mount --bind /sys /mnt/sys
    If you want to use tools from the live CD, also do:
    mount --bind /usr /mnt/usr
  • chroot /mnt
  • sudo update-grub2
  • sudo grub-install /dev/sdX
  • sudo grub-install --recheck /dev/sdX
  • exit and then unmount all partitions


List partitions

Solution 1. fdisk
fdisk <your disk> (must be root):
fdisk /dev/sda
Solution 2. /proc/partitions
cat /proc/partitions
It's possible too to use tools such as: parted, gparted.

FAT32 partitions

Windows is unable to format FAT 32 partitions bigger than 32Go, but Linux can do it (and then Windows can access those partitions):
mkfs -t vfat -F 32 /dev/sda3

Mounting Windows partitions under a given identity with a given mask

mount -t vfat -o rw,user,gid=users,dmask=0000,fmask=0111 /dev/hda... /mntpoint

Beware, NTFS partitions in RW is still really experimental for 2.6 kernels (possible to modify existing files, but not to create new ones !)

Mouting a file as a partition (here, file.iso is a CD image):
mount -o loop -t iso9660 file.iso /mnt/test

List mounted filesystems

To list all mounted systems, use mount or cat /proc/mounts.


Read this guide. To add a device:
btrfs device add /dev/sda /home
To list btrfs file systems:
btrfs filesystem show
Beware that in /etc/fstab, a given volume is mentioned only once even if it spans over multiple partitions. So typically, if we have a volume that uses /dev/sda1 and /dev/sdb1, /etc/fstab might only mention /dev/sda1 (depending on cases) though /dev/sdb1 is of course used!


Install ZFS on Linux Mint using the ubuntu-zfs package:
sudo add-apt-repository ppa:zfs-native/stable
sudo apt-get install ubuntu-zfs zfs-auto-snapshot
To list all possible properties:
# zfs get all tank
  • mount/umount: zfs mount or umount
  • status: zfs status tank
After updates, you may sometimes encounter issues with ZFS because SPL and ZFS don't have the same version. You should check it:
# dkms status
sudo dkms status
fglrx, 8.9600, 3.2.0-35-generic, x86_64: installed
fglrx, 8.9600, 3.2.0-36-generic, x86_64: installed
spl,, 3.2.0-36-generic, x86_64: installed
zfs,, 3.2.0-36-generic, x86_64: installed
If you need to remove a given version:
# sudo dkms remove -m zfs -v --all
If you need to add a version:
# sudo dkms add -m spl -v
# sudo dkms install -m spl -v
So for instance:
# sudo dkms remove -m zfs -v --all
# sudo dkms remove -m spl -v --all
# sudo dkms add -m spl -v
# sudo dkms add -m zfs -v
# sudo dkms install -m spl -v
# sudo dkms install -m zfs -v
Check that the ZFS kernel module is loaded: sudo modprobe zfs