Listing posts
Displaying posts 291 - 295 of 328 in total2017-04-06
Current disks partitions should be aligned at the one-megabyte boundary.
This is indicated by the fact that the start sector number for a partition can be divided by 2048 (2048 sectors * 512 bytes per sector equals 1048576 or one megabyte).
An extended partition is not required to respect this rule because it merely serve as a container for logical partitions which themselves are aligned at the one-megabyte boundaries.
For older disks the first partition always started at the 64th sector but for the newer ones it should start at 2048.
Test disk alignment with one of these commands:
1 2 | sfdisk -d /dev/sdX
fdisk -l -u /dev/sdX # with fdisk -v >= 2.17.1
|
Additional notes:
The disk physical block size information from Linux is often spurious, the kernel reports accurate information only for some disks, and the accuracy of the report also varies with the kernel version. This means that disk utilities (eg:
hdparm -I /dev/sdX
) are not reliable.The discard option in
/etc/fstab
is not needed if your SSD has enough overprovisioning (spare space) or you leave (unpartitioned) free space on the SSD.
Source: Thomas-Krenn, IBM, Debian Alignment and SSD optimizations
~~~ * ~~~
2017-03-16
Edit getaddrinfo
config in /etc/gai.conf
and uncomment this line:
1 2 | # For sites which prefer IPv4 connections change the last line to
precedence ::ffff:0:0/96 100
|
Source: AskUbuntu, ServerFault
~~~ * ~~~
2017-02-28
1 2 3 4 5 6 7 8 9 10 | # generate key pair with empty passphrase ssh-keygen -t rsa # upload your public key to the server cat ~/.ssh/id_rsa.pub | ssh user@host 'cat >> .ssh/authorized_keys' # depending on your SSH version you might also have to do: cat ~/.ssh/id_rsa.pub | ssh user@host 'cat >> .ssh/authorized_keys2' chmod 700 ~/.ssh chmod 640 ~/.ssh/authorized_keys2 |
Source: LinuxProblem, TheGeekStuff
~~~ * ~~~
2017-01-31
Choose an ftp server from IMDB opendata, download movies.list.gz, then parse it with the useful regexp from imdb-data-parser:
1 2 3 4 5 6 7 8 9 10 | # captures: # 0: #TITLE (UNIQUE KEY) # 1: (.*? \(\S{4,}\)) movie name + year # 2: (\(\S+\)) type ex:(TV) # 3: (\{(.*?) ?(\(\S+?\))?\}) series info ex: {Ally Abroad (#3.1)} # 4: (.*?) episode name ex: Ally Abroad # 5: ((\(\S+?\)) episode number ex: (#3.1) # 6: (\{\{SUSPENDED\}\}) is suspended? # 7: (.*) year re = /((.*? \(\S{4,}\)) ?(\(\S+\))? ?(?!\{\{SUSPENDED\}\})(\{(.*?) ?(\(\S+?\))?\})? ?(\{\{SUSPENDED\}\})?)\t+(.*)$/ |
See attached script imdb_movies_dump.rb
to dump movie titles sorted by year in 2010-2016 range.
~~~ * ~~~
2017-01-28
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # mount installed root system mount /dev/sdXY dir # mount pseudo folders cd dir mount -o bind /dev dev mount -o bind /sys sys mount -o bind /proc proc # open a shell into that system chroot `pwd` /bin/bash # ... do what you need ... exit # end chroot # clean mounts umount * cd .. umount dir |