{"id":14,"date":"2016-01-09T15:19:22","date_gmt":"2016-01-09T14:19:22","guid":{"rendered":"http:\/\/www.qltel.org\/wordpress\/?p=14"},"modified":"2017-01-23T16:38:11","modified_gmt":"2017-01-23T15:38:11","slug":"linux-op-externe-harddisk","status":"publish","type":"post","link":"https:\/\/www.qltel.org\/wordpress\/index.php\/2016\/01\/09\/linux-op-externe-harddisk\/","title":{"rendered":"Linux op externe harddisk"},"content":{"rendered":"<p>Het is verstandig om Linux over te zetten op een USB harddisk. Een SD-schijf is langzaam en niet bedoeld om veel op te schrijven. Na een tijdje gaat hij vanzelf stuk.<\/p>\n<p>Zet eerst Raspbian op een SD-kaart. Zet een bestandje genaamd ssh in de root en boot de PI. Log in en voer deze commando&#8217;s uit.<\/p>\n<p>apt-get update<br \/>\napt-get upgrade<br \/>\nrpi-update<br \/>\nreboot<\/p>\n<p>Doe dan<\/p>\n<p>sudo fdisk \/dev\/sda en dan l om te kijken wat er op de schijf staat.<\/p>\n<p>Unmount de externe schijf (wordt vanzelf gemount als de desktop aanstaat.) Is dus niet altijd nodig.<\/p>\n<p>Sudo umount \/dev\/sda1<\/p>\n<p>Gooi de bestaande partities eraf.<\/p>\n<p>d = delete<br \/>\nw= wegschrijven<\/p>\n<p>We gaan nu de schijf samenstellen met een kleine boot-partitie, een kleine swap-partitie en\u00a0 een grote partitie voor de data.<\/p>\n<p>Dit verhaal heb ik letterlijk overgenomen van een andere website.<\/p>\n<p><span class=\"apple-converted-space\">&#8211; Create the root partition:\u00a0 I made mine 16GB.\u00a0 Enter \u201cn\u201d to create a partition, \u201cp\u201d to select primary partition and then \u201c1\u201d to select partition number one.\u00a0 Select the default start sector.\u00a0 Enter +16G to specify the size.\u00a0\u00a0<\/span><br \/>\n<span class=\"apple-converted-space\">&#8211; Create the swap partition:\u00a0 Enter \u201cn\u201d to create a partition, \u201cp\u201d to select primary partition and then \u201c2\u201d to select partition number two.\u00a0 Select the default start sector.\u00a0 Enter +2G to specify the size.\u00a0 Enter \u201ct\u201d to set the type of a partition.\u00a0 Enter \u201c2\u201d and then \u201c82\u201d (was bij mij een ander nummer. Kijk in overzicht en kies Linux swap)\u00a0 to make this one a swap partition.<\/span><br \/>\n<span class=\"apple-converted-space\">&#8211; Create the data partition: \u00a0Enter \u201cn\u201d to create a partition, \u201cp\u201d to select primary partition and then \u201c3\u201d to select partition number three.\u00a0 Select the default start sector and default end sector to fill up the rest of the disk.\u00a0\u00a0<\/span><br \/>\n<span class=\"apple-converted-space\">&#8211; Enter \u201cp\u201d to list the partitions and verify things are like you expect.<\/span><br \/>\n<span class=\"apple-converted-space\">&#8211; Enter \u201cw\u201d to write the new partition table and exit.<\/span><\/p>\n<p>Formatteer de data-partitie als EXTv4. Duurt even<\/p>\n<p>sudo mkfs.ext4 \/dev\/sda3<\/p>\n<p>Formatteer de boot-partitie (schijnt niet nodig te zijn, maar bij mij werkte het niet als ik dat niet deed)<\/p>\n<p>sudo mkfs.ext4 \/dev\/sda1<\/p>\n<p>Formatteer de swap-partitie.<\/p>\n<p>sudo mkswap \/dev\/sda2<\/p>\n<p>Mount de root<\/p>\n<p>sudo mount \/dev\/sda1 \/mnt<\/p>\n<p>Zet de data van de SD-kaart over op de root-partitie. Dit duurt een tijdje (een hele tijd \ud83d\ude42 ).<\/p>\n<p>sudo rsync -avz &#8211;exclude &#8216;\/mnt&#8217; \/ \/mnt<\/p>\n<p>Pas de mount configuratiefile aan naar de nieuwe schijf:<\/p>\n<p>sudo nano\u00a0 \/mnt\/etc\/fstab<\/p>\n<p>Verander hier \/dev\/mmcblk0p2 naar \/dev\/sda1<\/p>\n<p>En voeg sda2 toe als swap-partitie<\/p>\n<p>sudo \/dev\/sda2 none swap sw 0 0<\/p>\n<p>Wegschrijven met CTRL-O, exit met CTRL-X<\/p>\n<p>Schakel de oude swap-file uit:<\/p>\n<p>sudo rm \/mnt\/etc\/rc?.d\/*dphys-swapfile<\/p>\n<p>En verwijder &#8216;m:<\/p>\n<p>sudo rm \/mnt\/var\/swap<\/p>\n<p>Edit dan de boot-configuratiefile\u00a0 naar de nieuwe partitie, maar stel eerst de oude veilig:<\/p>\n<p>sudo cp \/boot\/cmdline.txt \/boot\/cmdline.orig<br \/>\nsudo nano\u00a0 \/boot\/cmdline.txt<\/p>\n<p>verander \/dev\/mmcblk0p2 in \/dev\/sda1<\/p>\n<p>en dan weer CTRL-O en CTRL-X<\/p>\n<p>sudo reboot<\/p>\n<p>En klaar..<\/p>\n<p>Als je die data-partitie aan wilt koppelen aan een map, maak dan eerst die map aan.<\/p>\n<p>mkdir data-schijf<\/p>\n<p>edit dan \/etc\/fstab<\/p>\n<p>sudo nano \/etc\/fstab<\/p>\n<p>en zet daar bijvoorbeeld in:<\/p>\n<p>\/dev\/sda3\u00a0\u00a0 \/home\/pi\/data-schijf\u00a0 ext4 \u00a0\u00a0 defaults\u00a0 0 0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Het is verstandig om Linux over te zetten op een USB harddisk. Een SD-schijf is langzaam en niet bedoeld om veel op te schrijven. Na een tijdje gaat hij vanzelf stuk. Zet eerst Raspbian op een SD-kaart. Zet een bestandje genaamd ssh in de root en boot de PI. Log in en voer deze commando&#8217;s &hellip; <a href=\"https:\/\/www.qltel.org\/wordpress\/index.php\/2016\/01\/09\/linux-op-externe-harddisk\/\" class=\"more-link\">Verder lezen <span class=\"screen-reader-text\">Linux op externe harddisk<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-14","post","type-post","status-publish","format-standard","hentry","category-geen-categorie"],"_links":{"self":[{"href":"https:\/\/www.qltel.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/14","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qltel.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qltel.org\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qltel.org\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qltel.org\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=14"}],"version-history":[{"count":7,"href":"https:\/\/www.qltel.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/14\/revisions"}],"predecessor-version":[{"id":56,"href":"https:\/\/www.qltel.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/14\/revisions\/56"}],"wp:attachment":[{"href":"https:\/\/www.qltel.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=14"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qltel.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=14"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qltel.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=14"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}