GRUB
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-grub2To install GRUB on a partition:
$ sudo grub-install /dev/sdaNote 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/grubTo 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.#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" GRUB_CMDLINE_LINUX_DEFAULT=""Then do
update-grub
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) quitOr, 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 update-grub
The setup line actually resets the MBR. Of course, another way to do that is to copy back the MBR (using dd).
Disks
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
Partitions
List partitions
Solution 1. fdiskfdisk <your disk> (must be root):
fdisk /dev/sdaSolution 2. /proc/partitions
cat /proc/partitionsIt'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.Btrfs
Read this guide. To add a device:btrfs device add /dev/sda /homeTo list btrfs file systems:
btrfs filesystem showBeware 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!
ZFS
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-snapshotTo list all possible properties:
# zfs get all tank
- mount/umount: zfs mount or umount
- status: zfs status tank
# 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, 0.6.0.91, 3.2.0-36-generic, x86_64: installed zfs, 0.6.0.91, 3.2.0-36-generic, x86_64: installedIf you need to remove a given version:
# sudo dkms remove -m zfs -v 0.6.0.91 --allIf you need to add a version:
# sudo dkms add -m spl -v 0.6.0.91 # sudo dkms install -m spl -v 0.6.0.91So for instance:
# sudo dkms remove -m zfs -v 0.6.0.91 --all # sudo dkms remove -m spl -v 0.6.0.91 --all # sudo dkms add -m spl -v 0.6.0.91 # sudo dkms add -m zfs -v 0.6.0.91 # sudo dkms install -m spl -v 0.6.0.91 # sudo dkms install -m zfs -v 0.6.0.91Check that the ZFS kernel module is loaded: sudo modprobe zfs