Tuesday, August 10, 2010

HOW TO: Wipe Ubuntu after dual-booting with Windows 7

So, I have a blog post/write-up of some work, left half-finished from a long time ago.  But, that's because the work's half-finished, and a million things have gotten in the way of me doing... almost anything on the internet, since basically I tried to do everything from the last blog post.  But, I did have quite a bit of success with something else, and have some updates to contribute to the tutorial I worked from.  

The situation that this specific tutorial will apply to is if you only have an Ubuntu 10.04 boot disk available--say you bought an Acer Revo, which doesn't come with a disk drive, and so assumes you won't want a Win 7 install disk even though the OS comes bundled--and that you had previously installed Ubuntu, but want to get rid of it--say because wireless doesn't work out of the box for a fresh-install of 10.04 on your new Revo, but you're getting another computer that can be your Linux computer.  (This can probably be broadened to earlier versions of Ubuntu, and other versions of Windows, if you feel comfortable doing so.)  In essence, though, the idea is to wipe all traces of Linux, without resorting to the restore tools on a Windows install disk.  Even if you have the Windows install disk, by removing the GRUB bootloader from the Ubuntu live cd, you can save yourself one boot in the whole process.  

I used an OLD, OLD tutorial, that assumed two things: 
1. That a program called "ms-sys" was (still?) available with linux's apt-get. -- EDIT: I missed where it said to add "Universal" to the repositories of the LiveCD.  Oops. :-)  
2. That you were using Windows XP.  
Here's the tutorial; I'll explain how to work around these assumptions later.  

INSTRUCTIONS: 

1. Reboot into the Ubuntu LiveCD (choose to "try Ubuntu" instead of install it, and from there you will enter a live version of Ubuntu).  

2. Open System -> Administration -> GParted from the menu at the top left.  

3. Choose to delete the partition that has Ubuntu installed on it; choose to resize the partition with Windows 7; choose to make it take up the remainder of the drive. (I'm assuming that if you had the know-how to set-up a dual-boot, you've had your fair share of exposure to GParted, and know how to this.)  Note that even though it says this is dangerous and you should back things up, it has worked out just fine for me.  If there's an error, yes, that would be bad, but know that GParted *is* capable of doing the wipe and resize.  
Here, remember the name of the disk that your system is on.  I had an external plugged in, so my Win7/Ubuntu partitions were on /dev/sdb.  (In case you *haven't* had that much exposure to dual-booting and GParted, and thus will have a hard time remembering a name like that, with Ubuntu, harddrives get put in the /dev folder (for devices, if you really don't know), and then get named sda, sdb, sdc...  /dev/sdb just means "the second harddrive.")  Note that you don't need the partition with Windows, just the drive.  (I'm not even sure where in the Windows system the bootloader is kept--there seems to be a "System Partition" with a folder called "Boot," though, that showed up in Ubuntu but doesn't in Win7.  Besides, the MBR goes in the 1MB partition at the front of the drive.)  

[Another note: This is how far I got before I remembered that I hadn't gotten rid of Grub2 after installing Linux.  I re-booted, and it went straight to the Grub2 recovery prompt.  But, with no linux kernels left, there was absolutely nothing I could do from there.  After a fair bit of searching in Firefox with the LiveCD, and finding a lot of people just saying to use the Windows recovery tools on the install disk, I came across the old tutorial above.]  

4. (This is where we start to follow the older tutorial, with some modifications.)  Go to ms-sys and follow their instructions for installing ms-sys to the Live boot system.  (Where this gets installed to when the booted drive is read-only, I do not know...)  

5. To find the proper command-line arguments for running ms-sys on your system, run `man ms-sys`.  (The old tutorial said to use -m, but that would have, according to ms-sys's manual pages, written the MBR of a Windows XP system.  For Windows 7, the correct option was -7.  For multiple versions of Windows... I have no clue.)  

6. Run `sudo ms-sys -7 /dev/sdb` (or, the appropriate option for your version of Windows, and appropriate target for the partitioning scheme you've got).  This for me took NO TIME at all.  Eerily no time.  I'm pretty sure something more complicated like wiping the MBR partition with dd would have taken longer, let alone re-writing a proper MBR.  

7.  Reboot.  Instead of getting the grub2 recovery prompt here, I got the screen that said Windows was loading.  It then dropped out of that and checked the harddrive, which didn't take much time at all.  It then rebooted itself, and here I am, with a fully functioning Windows 7, with twice the available harddrive space, and no Linux.  

Maybe not the best informed tutorial yet, but, easily one of the most explanatory.  

Wednesday, July 28, 2010

Unix Copying Whining

Why is it so wrong of me to want to copy files in the following way? (in iPython)

for item in to_save:
   ....:     try:
   ....:         folder = os.path.split(item)[0]
   ....:         os.makedirs("backup_folder/" + folder)
   ....:     except:
   ....:         pass
   ....:     !cp $item folder/$item

This would be ideal for me.

[The issue I'm complaining about is that when you copy a file in Unix, the target location must already exist for the file.  Python's os.makedirs() makes intermediary folders (unlike the similar os.makedir())--but, in neither Python nor Bash can I find a function that copies, while making those intermediary folders.  I can't imagine a danger in this, but seem to want to do it while backing up, all of the time.]

Thursday, April 15, 2010

Streaming from a Koala/Win7 torrent box + sharing one G1 MacBook with your girlfriend

Yeah yeah, every tech website out there has a how-to for dual-booting a laptop.  And yeah yeah, triple booting a Mac has gotten infinitely easier since Microsoft ditched the MBR for (the possibility of) an EFI-based system (after releasing an entire OS that even Microsoft's most die-hard fans thought was bunk).  It's when you have
2 laptops
        1 1st Gen MacBook
                2.GHz Core Duo
                2 GB RAM
                320 Gig upgraded drive, that currently has OS X/Win7/Ubuntu/170 gigs out of 190 potential storage after the OS's
        1 HP Pavilion dv2000 Entertainment PC
                1.6 GHz Celeron
                2 GB RAM
                120 Gig harddrive, mostly unused
3 harddrives
        1  60GB SATA drive + external enclosure (empty, because everything was moved off of it)
        1  60GB FireWire drive used for backing up/booting for installing OS X from an 8GB bootdisk
        1 120GB SATA drive
        1 320GB SATA drive
2 multimedia lives
        30 GB music library
        30 GB iTunes library copies
        66.3 GB movies
        13 GB TV shows
1 income
that things get a little dicier.

Here's the plan:
1 server
        made from the HP
        Mainly Ubuntu
        Win7 as an option
        Shared user space between OS's, between two users
1 external
        320 GB harddrive for the server to read from/download to
1 useable laptop
        120 GB: room for two OS's, two users, and a fair amount of shared storage
        Feasibly usable by two people as the only computing resource:
                cut down on causal usage at home
                cut down on working at home
                cut down on travel baggage


And here's the process:  live-blogged and summarized afterwards.

Step 1. BACKUP.
Yeah yeah, everyone says to do it.  The sweet part about this plan is that no data will actually ever get wiped.  But, I did it anyways, just because if this HP machine turns out to be janky, I don't want it to be my fault.  (That is to say, if taking apart my girlfriend's computer makes her lose her pictures/music, yeah, she'll be pissed.)  That's all on a FireWire drive and won't get touched until the whole process is over.

Step 2. Switch the drives
At the beginning, the 60 Gig drive was in the external enclosure.  Tiny little thing from Transcend, and easy as pie to switch out the 2.5" SATA from--and no power other than the USB.  For $20, buy it whenever you buy any 2.5" SATA, because it will do nothing but help you.
I took that out.  I also took out the drive from the HP laptop, and then switched the two.  Now the HP laptop has 60GB and the external has 120; the external is technically bootable, but, I've burned an Ubuntu 9.10 CD-RW and am hoping to boot from it.

Step 3. Install Ubuntu on the server laptop.
Running into some problems loading Ubuntu.  If I "Try Ubuntu without any change to your computer"--or, "live-boot" it, I don't know why they don't say that at least somewhere--or if I try to "install Ubuntu" by going straight to the installer, it starts to load, gives me a little bit of splash screen, shakes the disk around, and then goes to black.  The live Ubuntu still lives, and recognizes the power button and starts to shut down, and lets go of the disk tray... but it doesn't get going.  I'd guess the computer's just slow, but, the very audible CD-drive stops spinning, so, likely not.  I checked the disc for defects, and, no dice that the burn was just faulty.
UPDATE:  Nope.  Just slow.  I mean, it's one thing to be slow form a live-boot disk.  But this is ridiculous.  I think it was ten minutes before the GUI showed up.  (HINT: If your Ubuntu install seems like it's not doing anything, it's probably doing something really slowly: try the arrow keys, and the console version of what's going on should pop-up: at least there, you can see that something is happening.)
[ An aside: There are some serious GUI problems running Ubuntu on this HP laptop.  I'm hoping it's just the live CD, but the entire screen flashes almost every time an element is changed.  It's painful just to point your eyeballs at, as a physical effect, let alone as a usable interface.  ]
Problem!  /home can't be on NTFS! The blog post I had been somewhat referring to said you should make an separate partition for your files.  Makes sense (right now, I've got OS X and Ubuntu sharing a home dir on a fourth partition on my Macbook).  But, it also said to make it NTFS--I think they weren't doing anything fancy, just, using the space for sticking files on that could be read by both systems.  I'm looking to make one home directory (at least, not have links from the OS partition to the home partition that might need to be changed later), so, that's not for me.  What's much more for me right now is making it ext4 (maybe 3? I forget now, as the Ubuntu install slideshow runs), and just wiping it later.  ----ext3, I just checked in gparted, since I managed to boot into the live disk instead of just installing it, as I had hoped to.  I went one below 4, because of this Wikipedia article that says that Windows NT could read ext3 with add-ons, but, not ext4. Validity? Uncertain. Willingness to back-up and wipe at this point? Certain.

Step 4. Make Ubuntu work.
This, usually, is not a step.  But man oh man is this laptop... I dunno, it's not old, or anything like that.  Ubuntu installs cleaner on my 2006 MacBook than it does on this 2007 HP thing.  I dunno?  But there's a lot of blinking, and no instant wireless.  So it's in the second bedroom/office, plugged into the router, just to update the 250-some packages that need updating since Karmic Koala was released.
That's done.  But still, a lot doesn't work.  Stupid drivers.

Step 5.  Sleep
Oh god the blinking.  It makes just looking at this screen for five seconds feel like I've stepped out of the past and into the future of 1000 years from now when computers are made of magic.  I think I can feel my head hurting less tomorrow, now.
Apparently, there's a bug in the standard distribution of the... Intel 945 graphics drivers?  That or xserver.  Or... you know, something between the graphics card and the OS and the install disk.  It might help that now I'm installing with the network on and it'll figure out its problems, but, I'm not holding out any serious hope, and, I still have to go through all the rigamarole it took to this this HP craptop to load from the CD in the first place, without just... timing out and having the disk stop spinning, mid gui-loading.  If it's not done in like ten minutes, I'm just going to sleep and trying again in the morning.

Saturday, February 27, 2010

SVN Client

I know, I know: real men use the commandline.  But it's the 21st century and I'd like to be able to click on things when I interact with them (if not, you know, use a magic iThreeFingerSwipe gesture on a touchscreen).  The thing is that whenever I try to do any kind of administration of svn (creating a repo, adding to it, checking out--anything but the simplest of update/commit cycles), I go through about four or five different errors before it works out.  I'm not terrible at bash, but there's something about svn that doesn't agree with what I think is intuitive, that makes the process more painful that it has to be, and that makes me have that special kind of worrying that comes from feeling like I'm working with something fragile and like I need to back everything up to external media just to make sure I don't lose anything.

So I'd like a client.  But they all suffer from even more problems.  Why does WebSVN, a php-based web client, somehow rely on a specific (and presently outdated--27/02/2010) version of svn, instead of just the one local to the server?  Why does RapidSVN give me
"Error: Error while updating filelist (Unknown error!
In file subversion/libsvn_ra_svn/streams.c Line 75)"
when it's supposed to make thinks better?

For now, at least when it comes to my digital life/homework and not major code projects, I'll stick to the OS's gui and just not deleting things, I think.