Monthly Archives: August 2016

Copy a HDD to SSD

I have an old laptop with Ubuntu 15.x and bought a new SSD to speedup the system a little bit. To copy the whole system from the HDD to the SSD you need to align the new partition on sector numbers which are dividable by 4096. So I have to create a primary partition starting on sector 4096 of the SSD and a Linux Swap partition. Use gparted and check the sector numbers twice.

To copy the existing data I found an article, which uses rsync:

rsync -rvlpogdstHEAX /hdd/ /ssd

It copies the Grub too, but in my case, the Grub uses UUIDs, which differ between HDD and SSD. So I have to change the grub.cfg manually:

chmod 644 /boot/grub/grub.cfg
vim /boot/grub/grub.cfg

Use now the vim replace function:

:%s/old-uuid/new-uuid/g

It replaces all occurrences of old-uuid with new-uuid. Then you need to open /etc/fstab and replace the UUIDs for the primary partition and the Swap partition too.

Install the SSD on the computer and start it, it boots your old system.

List all directories for group has access to

find ${dir} -type d -group ${group} -perm -g=r -print

Get all used ports

To find all used ports on a server use

# netstat -nlp